#C12943. Reverse the Order of Words
Reverse the Order of Words
Reverse the Order of Words
You are given a sentence that consists only of alphabetic characters and spaces. Your task is to reverse the order of the words in the sentence while keeping the order of characters within each word intact.
Any extra spaces (leading, trailing, or between words) should be ignored. In the output, words should be separated by a single space.
Note: A word is defined as a consecutive sequence of alphabetic characters.
For example, if the input is Hello world, the output should be world Hello.
The problem can be summarized mathematically as follows:
$$ \text{If } S = w_1 \; w_2 \; \dots \; w_n, \text{ then output } S' = w_n \; w_{n-1} \; \dots \; w_1. $$
inputFormat
The input consists of a single line containing the sentence. The sentence contains only alphabetic characters and spaces.
outputFormat
Output a single line containing the sentence with the order of words reversed. Each word in the output should be separated by exactly one space, and there should be no leading or trailing spaces.
## sampleHello
Hello