TikTok search infrastructure needs fast exact-keyword and prefix checks for user queries. Implement a Trie that supports initial word insertion and a sequence of dynamic operations.
Implement trie_operations(words, operations):
words is a list of lowercase strings inserted before any operation.['insert', word], ['search', word], or ['startsWith', prefix].search or startsWith operation, in their original order. Insert operations produce no result.search returns True only when the complete word was inserted.startsWith returns True when at least one inserted word begins with the given prefix.def trie_operations(words, operations):