There are a finite number of words in the dictionary, which implies there is an upper bound in the length of words.
The maximum number of iterations is the length of the longest word in the dictionary.
This means that part 1 of the problem can be solved in O(1)+O(1).
That doesn’t mean you will be happy with it. Not all O(1)s are equal.