29. Reverse Words
EasyString
Reverse the order of the words in a sentence. Words are separated by one or more spaces; print them separated by a single space with no leading or trailing spaces.
Input format
A single line of text.
Output format
The words in reverse order.
Example 1
Input
the sky is blue
Output
blue is sky the
Example 2
Input
hello world
Output
world hello
Constraints
1 ≤ length ≤ 10⁴
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…