#K56797. Reverse Words in a Sentence

    ID: 30278 Type: Default 1000ms 256MiB

Reverse Words in a Sentence

Reverse Words in a Sentence

Given a sentence, reverse the order of its words. A word is defined as a sequence of alphanumeric characters (letters, digits, and underscores). Any punctuation in the sentence should be ignored when forming the words.

For example, if the input is "Hello, world!", then the reversed sentence is "world Hello".

Note: The input will be provided via standard input and the output should be printed to standard output. If the input is an empty string, print nothing.

inputFormat

The input consists of a single line containing a sentence. The sentence may include letters, digits, punctuation, and whitespace.

outputFormat

Output the words of the sentence in reverse order on a single line. Words should be separated by a single space.

## sample
Hello, world!
world Hello