Trie code from sample Google interview