A word is a run of characters that are not spaces. Return a string with the words of s in reverse order, separated by exactly one space, with no space at the start or the end. s may have extra spaces anywhere.
Example 1
Input:
reverse_words('the sky is blue')
Output:
'blue is sky the'
Example 2
Input:
reverse_words(' hello world ')
Output:
'world hello'
0 <= len(s) <= 3 * 10**5s contains letters and spaces.No results yet
Run your code to check it against the examples, or submit to run every test.