Beginner Friendly Trie Implementation | C++ Solution
In addition to the general implementation of Trie, Storing an extra information how many prefixes end with a specific character in each node.\n\nstruct node{\n 
In addition to the general implementation of Trie, Storing an extra information how many prefixes end with a specific character in each node.\n```\nstruct node{\n    node* mp[26];\n    int cnt[26];\n    bool isPresent(char c){\n        if(mp[c-\'a\']==NULL) return false;\n        return true;\n    }\n    node* getKey(char c){\n        return mp[c-\'a\'];\n    }\n    void addKey(char c,node* temp){\n        mp[c-\'a\']=temp;\n    }\n    void increment(char c){\n        cnt[c-\'a\']++;\n    }\n};\nclass Solution {\npublic:\n    vector<int> sumPrefixScores(vector<string>& words) {\n        node *root=new node();\n        for(auto word:words){\n            node* temp=root;\n            for(int i=0;i<word.size();i++){\n                if(!temp->isPresent(word[i])){\n                    temp->addKey(word[i],new node());\n                }\n                temp->increment(word[i]);\n                temp=temp->getKey(word[i]);\n            }\n        }\n        vector<int> ans(words.size());\n        int k=0;\n        for(auto word:words){\n            int c=0;\n            node* temp=root;\n            for(int i=0;i<word.size();i++){\n                c+=temp->cnt[word[i]-\'a\'];\n                temp=temp->getKey(word[i]);\n            }\n            ans[k]=c;\n            k++;\n        }\n        return ans;\n    }\n};\n```
['Trie', 'C', 'C++']