reverse words in a string python leetcode