Easy c++ code using Trie Data Structure
\n\n# Code\n\nclass Trie{\n    public:\n    Trie* child[26];\n    bool isEnd;\n    Trie(){\n        for(int i=0;i<26;i++){\n            child[i]=NULL;\n        
\n\n# Code\n```\nclass Trie{\n    public:\n    Trie* child[26];\n    bool isEnd;\n    Trie(){\n        for(int i=0;i<26;i++){\n            child[i]=NULL;\n        }\n        isEnd=false; \n    }\n};\nclass MagicDictionary {\npublic:\n    Trie* root=new Trie();\n    MagicDictionary() {\n            \n    }    \n    \n    void buildDict(vector<string> dictionary) {\n        \n        for(int i=0;i<dictionary.size();i++){\n            Trie* curr=root;\n            string temp=dictionary[i];\n            for(int j=0;j<temp.length();j++){\n                int idx=temp[j]-97;\n                if(curr->child[idx]==NULL){\n                    curr->child[idx]=new Trie();\n                }\n                curr=curr->child[idx];\n            }\n            curr->isEnd=true;\n        }\n        \n    }\n    bool check(string searchWord) {\n        Trie* curr=root;\n        for(int i=0;i<searchWord.length();i++){\n            int idx=searchWord[i]-97;\n            if(curr->child[idx]==NULL){\n                return false;\n            }\n            curr=curr->child[idx];\n            \n        }\n        \n        return curr->isEnd;\n\n    }\n    \n  \n    bool search(string sword) {\n        int n=sword.size();\n        string word=sword;\n        for(int i=0;i<n;i++)\n        {\n            for(int j=0;j<26;j++)\n            {\n                if(\'a\'+j==sword[i])\n                    continue;\n                word[i]=\'a\'+j;\n                if(check(word))\n                    return true;\n            }\n            word[i]=sword[i];\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(dictionary);\n * bool param_2 = obj->search(searchWord);\n */\n/**\n * Your MagicDictionary object will be instantiated and called as such:\n * MagicDictionary* obj = new MagicDictionary();\n * obj->buildDict(dictionary);\n * bool param_2 = obj->search(searchWord);\n */\n/**\n * Your MagicDictionary object will be instantiated and called as such:\n * MagicDictionary* obj = new MagicDictionary();\n * obj->buildDict(dictionary);\n * bool param_2 = obj->search(searchWord);\n */\n```
['C++']