LeadSquared interview question

Reverse words in a string