#C10128. Reverse the Words in a String
Reverse the Words in a String
Reverse the Words in a String
You are given a string s which consists of a sequence of words separated by whitespace. Your task is to reverse the order of the words.
Let \( S \) be the input string and let \( W = \{w_1, w_2, \dots, w_n\} \) be the sequence of words obtained by splitting \( S \) by whitespace. The output is the string \( T = w_n \; w_{n-1} \; \dots \; w_1 \), with a single space between words. Leading and trailing spaces should be ignored.
For example, if the input string is "Hello World", the output should be "World Hello".
inputFormat
The input consists of a single line containing the string \( s \). The string may contain multiple spaces between words. You should ignore any leading or trailing spaces.
outputFormat
Output a single line which is the reversed word order of the input string. Words should be separated by a single space.
## sampleHello World
World Hello