implemented trie for dictionary