[C++] simple easy solution using Trie
\nclass TrieNode {\npublic:\n    TrieNode *children[26];\n    bool is_terminal;\n    \n    TrieNode() {\n        for(int i=0;i<26;++i) {\n            children[i
```\nclass TrieNode {\npublic:\n    TrieNode *children[26];\n    bool is_terminal;\n    \n    TrieNode() {\n        for(int i=0;i<26;++i) {\n            children[i]=NULL;\n        }\n        is_terminal=false;\n    }\n};\n\nclass MagicDictionary {\npublic:\n    /** Initialize your data structure here. */\n    TrieNode *root=new TrieNode();\n    MagicDictionary() {\n        \n    }\n    \n    void insert(string s) {\n        TrieNode *temp=root;\n        for(char c: s) {\n            int idx=c-\'a\';\n            if(temp->children[idx]==NULL) {\n                temp->children[idx]=new TrieNode();\n            }\n            temp=temp->children[idx];\n        }\n        temp->is_terminal=true;\n    }\n    /** Build a dictionary through a list of words */\n    void buildDict(vector<string> dict) {\n        for(string s: dict) {\n            insert(s);\n        }\n    }\n    \n    bool find(string s) {\n        TrieNode *temp=root;\n        for(char c: s) {\n            int idx=c-\'a\';\n            if(temp->children[idx]==NULL) {\n                return false;\n            }\n            temp=temp->children[idx];\n        }\n        if(temp->is_terminal==true) {\n            return true;\n        }\n        else {\n            return false;\n        }\n    }\n    /** Returns if there is any word in the trie that equals to the given word after modifying exactly one character */\n    bool search(string s) {\n        for(int i=0;i<s.length();++i){\n            for(int j=0;j<26;++j) {\n                char c=j+\'a\';\n                if(c==s[i]) continue;\n                swap(s[i],c);\n                if(find(s)) {\n                    return true;\n                }\n                swap(s[i],c);  //Backtrack\n            }\n        }\n        return false;\n    }\n};\n\n/**\n * Your MagicDictionary object will be instantiated and called as such:\n * MagicDictionary* obj = new MagicDictionary();\n * obj->buildDict(dict);\n * bool param_2 = obj->search(word);\n */\n```
['Backtracking', 'Trie', 'C++']