C++ Solution || Clean Code || Trie
\nstruct Node{\n    Node* links[26];\n    bool flag = false;\n    \n    bool containsKey(char ch){\n        return links[ch-\'a\']!=NULL;\n    }\n    \n    Node
```\nstruct Node{\n    Node* links[26];\n    bool flag = false;\n    \n    bool containsKey(char ch){\n        return links[ch-\'a\']!=NULL;\n    }\n    \n    Node* get(char ch){\n        return links[ch-\'a\'];\n    }\n    \n    void put(char ch,Node* node){\n        links[ch-\'a\'] = node;\n    }\n    \n    void setEnd(){\n        flag = true;\n    }\n    \n    bool isEnd(){\n        return flag;\n    }\n};\n\nclass WordDictionary {\n    Node* root;\npublic:\n    WordDictionary() {\n        root = new Node();\n    }\n    \n    void addWord(string word) {\n        Node* node = root;\n        for(int i = 0;i<word.size();i++){\n            if(!node->containsKey(word[i])){\n                node->put(word[i],new Node());\n            }\n            node = node->get(word[i]);\n        }\n        node->setEnd();\n    }\n    \n    bool search(Node* node,string word){\n        for(int i = 0;i<word.size();i++){\n            if(word[i]==\'.\'){\n                for(int j = 0;j<26;j++){\n                    if(node->links[j]!=NULL){\n                        if(search(node->links[j],word.substr(i+1))){ //imp\n                            return true;\n                        }\n                    }\n                }\n                return false;\n            }\n            if(!node->containsKey(word[i])){\n                return false;\n            }\n            else\n            node = node->get(word[i]);\n        }\n        return node->isEnd();\n    }\n    \n    bool search(string word) {\n        Node* node = root;\n        return search(node,word);\n    }\n};\n```
['Depth-First Search', 'Trie', 'Iterator']