Prefix word count
Your task
Build a trie from the list words (duplicates allowed and counted separately). Then for each query prefix, return how many words in the collection start with that prefix. The empty-string prefix matches every word. Words and prefixes contain only lowercase letters. Return the list of counts in query order.
Examples
trie_prefix_counts(words: list[str], prefixes: list[str]) -> list[int]Example 1
Input
trie_prefix_counts(["apple", "app", "apricot", "banana"], ["app", "ap", "b", "xyz", ""])Output
[2, 3, 1, 0, 4]