Cpp Solution using trie
```\nclass node{\n  public:\n    node v[26];\n    int end=0;\n    \n    bool ispresent(char c){\n        return this->v[c-\'a\']!=NULL;\n    }\n    \n    void c
```\nclass node{\n  public:\n    node* v[26];\n    int end=0;\n    \n    bool ispresent(char c){\n        return this->v[c-\'a\']!=NULL;\n    }\n    \n    void create(char c,node* n){\n        this->v[c-\'a\']=n;\n    }\n    \n    void setend(){\n        this->end=1;\n    }\n};\n\nclass trie{\n    public:\n    node* root=new node();\n    \n    void insert(string key){\n        node* r1=root;\n        for(auto ele:key){\n            \n            if(!r1->ispresent(ele)){\n                r1->create(ele,new node());    \n            }\n            \n            r1=r1->v[ele-\'a\'];\n        }\n        \n        r1->setend();\n    }\n    \n    bool func(string s,int j,node* rm){\n              \n        for(j;j<s.size();j++){\n            if(!rm->ispresent(s[j]))return false;\n            \n            rm=rm->v[s[j]-\'a\'];\n        }\n        \n        return rm->end;\n    }\n    \n    \n    bool search(string s){\n        node* r1=root;\n        int a=0;\n        \n        for(int j=0;j<s.size();j++){\n            \n             for(int i=0;i<26;i++){\n                if(r1->ispresent(char(\'a\'+i)) && s[j]-\'a\'!=i){\n                    if(func(s,j+1,r1->v[i]))return true;   \n                }\n             }   \n            \n            if(r1->ispresent(s[j]))r1=r1->v[s[j]-\'a\'];\n            else return false;\n        }\n        \n        return false;\n    }\n    \n};\n\nclass MagicDictionary {\npublic:\n    trie* root;\n    MagicDictionary() {\n        root=new trie();\n    }\n    \n    void buildDict(vector<string> dictionary) {\n        for(auto ele:dictionary){\n            root->insert(ele);\n        }\n    }\n    \n    bool search(string searchWord) {\n        return root->search(searchWord);\n    }\n};
['Trie', 'C++']