#C230. Reverse Words in a Sentence
Reverse Words in a Sentence
Reverse Words in a Sentence
Given an input sentence, reverse the order of the words. A word is defined as a contiguous sequence of non-space characters. The words in the input are separated by one or more spaces. The output should contain the words in reversed order, separated by a single space.
For example, if the input is "The quick brown fox", the output should be "fox brown quick The".
Note: If the input is an empty string, the output should also be an empty string.
inputFormat
The input consists of a single line read from standard input (stdin) representing the sentence. The sentence may be empty, or contain one or more words separated by spaces.
outputFormat
The output, printed to standard output (stdout), is the sentence with the order of the words reversed. Words should be separated by a single space.## sample
Hello World
World Hello
</p>