New York Times Interview Question

Reverse words in a string