#151 - Reverse Words in a String
Given an input string s, reverse the order of the words. A word is a maximal sequence of non-space characters. The returned string should have a single space between words and no leading/trailing spaces.
| Input | Output |
|---|---|
s = "the sky is blue" | "blue is sky the" |
s = " hello world " | "world hello" |
s = "a good example" | "example good a" |