#K70162. Reverse the Order of Words
Reverse the Order of Words
Reverse the Order of Words
You are given a string s containing words separated by spaces. Your task is to reverse the order of the words while keeping the characters within each word in their original order.
For example, if s = "hello world"
, then the output should be "world hello"
.
Note: When splitting the string, consider any sequence of whitespace characters as a delimiter. Extra spaces should be ignored.
In mathematical notation, if we denote the positions of the words as \(w_1, w_2, \dots, w_n\), the output should be \(w_n, w_{n-1}, \dots, w_1\).
inputFormat
The input is given from standard input (stdin) as a single line containing the string s.
outputFormat
Output the modified string with the order of words reversed, using standard output (stdout).
## samplehello world
world hello