Python: Trie + BFS
\nclass TrieNode(object):\n    def __init__(self):\n        self.children=collections.defaultdict(TrieNode)\n        self.isEnd=False\n        self.word =''\n  
```\nclass TrieNode(object):\n    def __init__(self):\n        self.children=collections.defaultdict(TrieNode)\n        self.isEnd=False\n        self.word =''\n        \nclass Trie(object):\n    def __init__(self):\n        self.root=TrieNode()\n        \n    def insert(self, word):\n        node=self.root\n        for c in word:\n            node =node.children[c]\n        node.isEnd=True\n        node.word=word\n    \n    def bfs(self):\n        q=collections.deque([self.root])\n        res=''\n        while q:\n            cur=q.popleft()\n            for n in cur.children.values():\n                if n.isEnd:\n                    q.append(n)\n                    if len(n.word)>len(res) or n.word<res:\n                        res=n.word\n        return res \n    \nclass Solution(object):\n    def longestWord(self, words):\n        trie = Trie()\n        for w in words: trie.insert(w)\n        return trie.bfs()\n\n    \n```
[]