Trie || striver Templete
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nstruct Node{\n    Node* links[26];\n    int cnt = 0;  \n    bool flag = false; \n\n    bool isPresent(char ch){\n        return links[ch - \'a\'] != NULL; \n    }\n\n    void put(char ch, Node* node){\n        links[ch - \'a\'] = node;\n    }\n\n    Node* get(char ch){\n        return links[ch - \'a\']; \n    }\n\n    void increaseCount() {\n        cnt++;\n    }\n\n    int getCount() {\n        return cnt;\n    }\n\n    void setEnd(){\n        flag = true; \n    }\n\n    bool isEnd(){\n        return flag; \n    }\n};\n\nclass Solution {\n    private: \n    Node* root; \n    public:\n    Solution(){\n        root = new Node(); \n    }\n\n     void insert(string word){\n        Node* node = root; \n        for(int i = 0; i < word.size(); i++){\n            if(!node->isPresent(word[i])){\n                node->put(word[i], new Node()); \n            }\n            node = node->get(word[i]); \n            node->increaseCount();   \n        }\n        node->setEnd(); \n    }\n\n     int search(string word){\n        Node* node = root; \n        int score = 0; \n        for(int i = 0; i < word.size(); i++){\n            if(!node->isPresent(word[i])) return score; \n            node = node->get(word[i]); \n            score += node->getCount();  \n        }\n        return score;  \n    }\n\n    vector<int> sumPrefixScores(vector<string>& words) {\n         for(auto &word : words){\n            this->insert(word); \n        }\n \n        vector<int> result; \n        for(auto &word : words){\n            result.push_back(this->search(word)); \n        }\n        return result;  \n    }\n};\n\n```
['String', 'Trie', 'C++']