You're building a simple autocomplete feature for a search bar. You are given a list of dictionary words and a prefix string. Implement a function that returns how many words in the dictionary start with the given prefix. Build the words into a trie (prefix tree) structure and use it to count matches. Words may repeat in the input list, and repeats should each count separately.