#C12388. Reverse the Order of Words in a Sentence
Reverse the Order of Words in a Sentence
Reverse the Order of Words in a Sentence
Given a sentence, reverse the order of its words while removing extra spaces so that each word is separated by a single space. Punctuation remains attached to the words. An empty input should yield an empty output.
The input is received from the standard input (stdin) and the output should be sent to the standard output (stdout). Use \( \LaTeX \) format for any formulas if needed.
inputFormat
The input consists of a single line containing a sentence. The sentence may include leading, trailing, or multiple spaces between words.
outputFormat
Output a single line containing the words of the sentence in reverse order. Words must be separated by a single space without any extra spaces at the beginning or the end.
## sampleThis is a test.
test. a is This