#K15171. Reverse the Order of Words
Reverse the Order of Words
Reverse the Order of Words
You are given a string S that consists of a sequence of words separated by spaces. Your task is to produce a new string where the order of the words is reversed, while each individual word retains its original character order.
For example, if S is "Hello world! This is a test.", the output should be "test. a is This world! Hello".
Note that the input may contain extra spaces at the beginning, at the end, or between words. In such cases, treat any sequence of one or more spaces as a single delimiter.
If the input string is empty or contains only spaces, output an empty string.
The formula representing the transformation can be written as:
\[ \text{Output} = \text{join}(\text{reverse}(\text{split}(S))) \]
inputFormat
The input is provided from stdin as a single line containing the string S. The string may include multiple spaces between words, as well as leading and trailing spaces.
outputFormat
Output a single line to stdout representing the words of S in reversed order, with a single space separating the words. If the input string is empty or contains only spaces, output an empty string.
## sampleHello
Hello