#K84947. Reverse Words in a String

    ID: 36532 Type: Default 1000ms 256MiB

Reverse Words in a String

Reverse Words in a String

In this problem, you are given a string s consisting of words separated by spaces. Your task is to reverse the order of the words. More formally, if the string contains words \(w_1, w_2, \dots, w_n\), you should output the string \(w_n, w_{n-1}, \dots, w_1\) where the words are separated by a single space.

For example, if the input is "hello world", the output should be "world hello".

Please note that you must read the input from stdin and print the result to stdout.

inputFormat

The input consists of a single line containing a string \(s\) which may include multiple words separated by spaces.

Input is provided via stdin.

outputFormat

Output the words of the string in reverse order, maintaining a single space between words. The result should be printed to stdout.

## sample
hello
hello