def search(self, word):
        cur = self.root
        for w in word:
            if w in cur.children:
                cur = cur.children[w]
            else:
                return False

        if not cur.ended:  # not ended here
            return False

        return True
Returns if the word is in the trie.
dataset/ETHPy150Open algorhythms/LeetCode/208 Implement Trie (Prefix Tree).py/Trie.search