Implement a trie-based tokenizer | xAI Interview Question