#C12211. Reverse Sentence

    ID: 41614 Type: Default 1000ms 256MiB

Reverse Sentence

Reverse Sentence

Given a sentence, reverse the order of its words. Words are defined as continuous sequences of non-space characters. Any extra spaces in the input should be ignored. Formally, if the input sentence is given by ( S = w_1 \ w_2 \ \ldots \ w_n ) then the output should be ( w_n \ w_{n-1} \ \ldots \ w_1 ).

inputFormat

The input consists of a single line containing a sentence, where words may be separated by one or more spaces. The input is read from stdin.

outputFormat

Output the sentence with the order of words reversed. Words should be separated by a single space and no leading or trailing spaces should be present in the output. The output is written to stdout.## sample

Hello
Hello