C++ || Trie
Code\n\nclass TrieNode{\npublic:\n    TrieNode *child[26];\n    bool end = false;\n    TrieNode(){\n        for(int i = 0; i < 26; i++)\n            child[i] = 
# Code\n```\nclass TrieNode{\npublic:\n    TrieNode *child[26];\n    bool end = false;\n    TrieNode(){\n        for(int i = 0; i < 26; i++)\n            child[i] = NULL;\n    }\n};\nclass WordDictionary {\n      TrieNode *root ;\npublic:\n    WordDictionary() {\n        root =  new TrieNode();\n    }\n    \n    void addWord(string word) {\n        int idx = 0;\n        TrieNode * node = root;\n        for(char c: word) {\n            idx = c -\'a\';\n            if(!node->child[idx])\n                node->child[idx] = new TrieNode();\n            node = node->child[idx];\n        }\n        node->end = true;\n    }\n    \n    bool search(string word) {\n        TrieNode *node = root;\n        return search(word, 0, node);\n    }\n    bool search(string &word, int idx , TrieNode *node ) {\n        if(!node) return 0;\n        if(idx == word.size()) return node->end;\n        if(word[idx] != \'.\')\n            return search(word, idx+1, node->child[word[idx]-\'a\']);\n\n        for(int key = 0; key< 26; key++)\n            if(search(word, idx+1, node->child[key]))\n                return true;\n        return false;\n    }\n};\n\n/**\n * Your WordDictionary object will be instantiated and called as such:\n * WordDictionary* obj = new WordDictionary();\n * obj->addWord(word);\n * bool param_2 = obj->search(word);\n */\n```
['Trie', 'C++']