Given an input string s, reverse the order of the words. A word is a sequence of non-space characters, and words are separated by spaces. Return a string of the words in reverse order with a single space between them. The string may have leading or trailing spaces or multiple spaces between words, which should be reduced.
Click Run to execute sample tests.