C++ easy solution
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```java []\nclass WordDictionary {\n    Map<Integer, List<String>> map = new HashMap<>();\npublic void addWord(String word) {\n    int index = word.length();\n\tif (!map.containsKey(index)) {\n\t    List<String> list = new ArrayList<>();\n\t    list.add(word);\n\t\tmap.put(index, list);\n\t} else {\n\t\tmap.get(index).add(word);\n\t}\n}\n\n\npublic boolean search(String word) {\n  int index = word.length();\n  if (!map.containsKey(index)) {\n      return false;\n  }\n  \n  List<String> list = map.get(index);\n  for(String s : list) { \n      if(isSame(s, word)) { // when word has \'.\'\n          return true;\n      }\n  }\n  return false;\n}\n\npublic boolean isSame(String s, String word) { // word has \'.\'\n    for (int i = 0; i < s.length(); i++) {\n        if (word.charAt(i) != \'.\' && s.charAt(i) != word.charAt(i)) {\n            return false;\n        }\n    }\n    return true;\n}\n}\n\n\n```
['Java']