TRIE makes it easy !!
\n# Code\ncpp []\nclass Node {\npublic:\n    unordered_map<char, pair<Node*, int>> arr;\n    bool isEnd = false;\n};\n\nvoid insert(Node* root, string& word) {\
\n# Code\n```cpp []\nclass Node {\npublic:\n    unordered_map<char, pair<Node*, int>> arr;\n    bool isEnd = false;\n};\n\nvoid insert(Node* root, string& word) {\n    Node* curr = root;\n    for (auto ch : word) {\n        if (curr->arr.find(ch) == curr->arr.end()) {\n            curr->arr[ch] = {new Node(), 0};\n        }\n        curr->arr[ch].second++;\n        curr = curr->arr[ch].first;\n    }\n    curr->isEnd = true;\n}\n\nint solve(Node* root, string& word) {\n    int cnt = 0;\n    Node* curr = root;\n    for (char ch : word) {\n        if (curr->arr.find(ch) == curr->arr.end()) {\n            break;\n        }\n        cnt += curr->arr[ch].second;\n        curr = curr->arr[ch].first;\n    }\n    return cnt;\n}\n\nclass Solution {\npublic:\n    vector<int> sumPrefixScores(vector<string>& words) {\n        Node* root = new Node();\n        for (auto& word : words) {\n            insert(root, word);\n        }\n        vector<int> ans;\n        for (auto& word : words)\n            ans.push_back(solve(root, word));\n        return ans;\n    }\n};\n\n```
['Array', 'String', 'Trie', 'Counting', 'C++']