C++ || EASY || TRIE
Code\n\nclass trie{\n    public:\n        int x;\n        trie *v[26];\n};\nvoid maketrie(string str,trie* node){\n    for(auto &i: str){\n        if(node->v[i-
# Code\n```\nclass trie{\n    public:\n        int x;\n        trie *v[26];\n};\nvoid maketrie(string str,trie* node){\n    for(auto &i: str){\n        if(node->v[i-\'a\'] == NULL){\n            node->v[i-\'a\'] = new trie();\n            node = node->v[i-\'a\'];\n            node->x = node->x +1 ;\n        }else{\n            node = node->v[i-\'a\'];\n            node->x = node->x +1 ;\n        }\n    }\n}\nvoid solve(string str,trie* node,int &x){\n    trie* p = node;\n    for(auto &i: str){\n        p = p->v[i-\'a\'];\n        x += p->x;\n    }\n}\nclass Solution {\npublic:\n    vector<int> sumPrefixScores(vector<string>& words) {\n        trie *node = new trie();\n        for(auto &i: words){\n            maketrie(i,node);\n        }\n        int x = 0;\n        vector<int> ans;\n        for(auto &i: words){\n            x = 0;\n            solve(i,node,x);\n            ans.push_back(x);\n        }   \n        return ans;\n    }\n};\n```
['Array', 'String', 'Trie', 'Counting', 'C++']