TRIE solved with rudimentary Trie class. Will probably move to COMMON.