Easy to read length based set solution.
py\nfrom collections import defaultdict\nclass WordDictionary:\n\n    def __init__(self):\n        """\n        Initialize your data structure here.\n        ""
```py\nfrom collections import defaultdict\nclass WordDictionary:\n\n    def __init__(self):\n        """\n        Initialize your data structure here.\n        """\n        self.words = defaultdict(set)\n        \n\n    def addWord(self, word: str) -> None:\n        """\n        Adds a word into the data structure.\n        """\n        self.words[len(word)].add(word)\n        \n\n    def search(self, word: str) -> bool:\n        """\n        Returns if the word is in the data structure. A word could contain the dot character \'.\' to represent any one letter.\n        """\n        for other in self.words[len(word)]:\n            any_mismatch = any(word[x] != \'.\' and word[x] != other[x] for x in range(len(word)))\n            if not any_mismatch:\n                return True\n        return False\n\n```
['Python', 'Python3']