simple and easy C++ solution || Trie
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook
\n# if it\'s help, please up \u2B06 vote! \u2764\uFE0F\n\n###### Let\'s Connect on LinkedIn: www.linkedin.com/in/shishirrsiam\n###### Let\'s Connect on Facebook: www.fb.com/shishirrsiam\n\n# Complexity\n- Time complexity: O(n * l)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```cpp []\nclass TrieNode {\n    public:\n    int count;\n    TrieNode* children[26];\n    TrieNode() : count(0), children{NULL} {}\n};\nclass Solution {\npublic:\n    vector<int> sumPrefixScores(vector<string>& words) \n    {\n        auto *root = new TrieNode();\n\n        for(auto w : words)\n        {\n            auto *node = root;\n            for(auto ch : w)\n            {\n                int assci = ch - \'a\';\n                if(not node->children[assci])\n                    node->children[assci] = new TrieNode();\n                node = node->children[assci];\n                node->count += 1;\n            }\n        }\n\n        vector<int>ans;\n        for(auto w : words)\n        {\n            auto sum  = 0;\n            auto *node = root;\n            for(auto ch : w)\n            {\n                int assci = ch - \'a\';\n                node = node->children[assci];\n                sum += node->count;\n            }\n            ans.push_back(sum);\n        }\n\n        return ans;\n    }\n};\n```
['Array', 'String', 'Trie', 'Counting', 'C++']