Ternary Search Tree for word breaking