My JAVA Trie based solution
public class WordDictionary {\n        WordNode root = new WordNode();\n    \tpublic void addWord(String word) {\n    \t\tchar chars[] = word.toCharArray();\n  
    public class WordDictionary {\n        WordNode root = new WordNode();\n    \tpublic void addWord(String word) {\n    \t\tchar chars[] = word.toCharArray();\n            addWord(chars, 0, root);\n        }\n    \t\n    \tprivate void addWord(char[] chars, int index, WordNode parent) {\n    \t\tchar c = chars[index];\n    \t\tint idx = c-'a';\n            WordNode node = parent.children[idx];\n            if (node == null){\n            \tnode = new WordNode();\n            \tparent.children[idx]=node;\n            }\n            if (chars.length == index+1){\n            \tnode.isLeaf=true;\n            \treturn;\n            }\n            addWord(chars, ++index, node);\n        }\n    \n    \n        public boolean search(String word) {\n        \treturn search(word.toCharArray(), 0, root);\t\t\t\t     \n        }\n        \n        private boolean search(char[] chars, int index, WordNode parent){\n        \tif (index == chars.length){\n        \t\tif (parent.isLeaf){\n        \t\t\treturn true;\n        \t\t}\n        \t\treturn false;\n        \t}\n        \tWordNode[] childNodes = parent.children;\n        \tchar c = chars[index];\n        \tif (c == '.'){\n    \t    \tfor (int i=0;i<childNodes.length;i++){\n    \t    \t\tWordNode n = childNodes[i];\n    \t    \t\tif (n !=null){\n    \t    \t\t\tboolean b = search(chars, index+1, n);\n    \t    \t\t\tif (b){\n    \t    \t\t\t\treturn true;\n    \t    \t\t\t}\n    \t    \t\t}\n    \t    \t}\n    \t    \treturn false;\n        \t}\n        \tWordNode node = childNodes[c-'a'];\n        \tif (node == null){\n        \t\treturn false;\n        \t}\n        \treturn search(chars, ++index, node);\n        }\n        \n    \n        \n        private class WordNode{\n        \tboolean isLeaf;\n        \tWordNode[] children = new WordNode[26];\n        }\n    }
[]