Input: a string of words separated by spaces. Only the letters a
-z
are utilized.
Output: the string in the same order, but with subsequent duplicate words removed.
There must be no extra spaces at the end of your returned string.
The solution must be O(n)
.