#K77067. Reverse Words in a String

    ID: 34782 Type: Default 1000ms 256MiB

Reverse Words in a String

Reverse Words in a String

You are given a string s containing words separated by spaces. Your task is to reverse the order of the words in the string.

More formally, if the input string is given by $$ s = w_1 \; w_2 \; \dots \; w_n, $$ you should output a new string: $$ s' = w_n \; w_{n-1} \; \dots \; w_1. $$

Note that any extra leading or trailing spaces in the input should be removed in the output, and words are considered to be sequences of non-space characters.

inputFormat

The input is read from stdin as a single line containing the string s.

outputFormat

Output to stdout the transformed string with the words in reverse order.

## sample
Hello World
World Hello