A **trie** (pronounced as "try") or **prefix tree** is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
- `insert(word)` inserts the string `word` into the trie.
- `search(word)` returns `true` if the string `word` is in the trie (i.e., was inserted before), and `false` otherwise.
- `startsWith(prefix)` returns `true` if there is a previously inserted string `word` that has the prefix `prefix`, and `false` otherwise.
**Note:** For this problem, implement operations as a function that takes a list of commands and returns the results. Return `null` for void operations (insert).
- 1 <= word.length, prefix.length <= 2000
- word and prefix consist only of lowercase English letters.
- At most 3 * 10^4 total calls will be made to insert, search, and startsWith.