c++ two solution trie || hashing
\nclass Solution\n{\n    public:\n        struct node\n        {\n            node *child[26] = { NULL\n            };\n            int count = 0;\n        };\n
```\nclass Solution\n{\n    public:\n        struct node\n        {\n            node *child[26] = { NULL\n            };\n            int count = 0;\n        };\n    node *root = new node();\n    void insert(string & s)\n    {\n        int n = s.size();\n        node *curr = root;\n        for (int i = 0; i < n; i++)\n        {\n            int index = s[i] - \'a\';\n            if (curr->child[index] == NULL)\n            {\n                curr->child[index] = new node();\n            }\n            curr = curr->child[index];\n            curr->count++;\n        }\n    }\n    int find(node *curr, string &s)\n    {\n        int ans = 0;\n        for (char &ch: s)\n        {\n            if (curr->child[ch - \'a\'] != NULL)\n            {\n                curr = curr->child[ch - \'a\'];\n                ans += curr->count;\n            }\n        }\n        return ans;\n    }\n    vector<int> sumPrefixScores(vector<string> &nums)\n    {\n        int n = nums.size();\n        for (int i = 0; i < n; i++)\n        {\n            insert(nums[i]);\n        }\n        vector<int> ans;\n        for (int i = 0; i < n; i++)\n        {\n            node *curr = root;\n            int value = find(curr, nums[i]);\n            ans.push_back(value);\n        }\n        return ans;\n    }\n};\n```\n\n```\nclass Solution {\npublic:\n    vector<int> sumPrefixScores(vector<string>&nums) \n    {\n        int n=nums.size();\n        unordered_map<long long,int>mp;\n        long long mod=1e15+7;\n        for(int i=0;i<n;i++)\n        {\n            long long hash=0;\n            for(auto &ch:nums[i])\n            {\n                hash=(hash*97+(ch))%mod;\n                mp[hash]++;\n            }\n        }\n        vector<int>ans(n,0);\n        for(int i=0;i<n;i++)\n        {\n            int count=0;\n            long long hash=0;\n            for(auto &ch:nums[i])\n            {\n                hash=(hash*97+(ch))%mod;\n                count+=mp[hash];\n            }\n            ans[i]=count;\n        }\n        return ans;\n    }\n};\n```
['Trie', 'C', 'C++']