solution to Reverse words in a string