oh, it is a typo, should be trie.
Suppose the string length is N, the dictionary contains M words, and the words average length is K. Then Building the Dictionary tree need O(M * K) time.
And searching the string need O(N) time.
So the total time is O(N) + O(M*K).
But please note, we only need to build the dictionary trie once in the real life. And keep using it for different incoming strings.
That's why I say the time is O(N)