#C3030. Reverse Words in a String

    ID: 46413 Type: Default 1000ms 256MiB

Reverse Words in a String

Reverse Words in a String

Given an input string s consisting of alphabetic characters and spaces, reverse the order of the words while keeping the characters within each word in their original order. A word is defined as a maximal substring consisting of non-space characters.

For example, if s = "Hello World", the output should be "World Hello".

More formally, let the input string be represented as a sequence of words: \(w_1, w_2, \ldots, w_n\). The output should be \(w_n, w_{n-1}, \ldots, w_1\), with a single space separating each pair of consecutive words.

inputFormat

The input consists of a single line containing a string s which may include alphabetic characters and spaces. The string can have leading or trailing spaces and multiple spaces between words.

The input should be read from standard input (stdin).

outputFormat

Output a single line containing the string with its words in reversed order. The output should be written to standard output (stdout).

## sample
Hello
Hello