Reverse order of words in a string

O(N) solution.