#K82822. Reverse Words

    ID: 36061 Type: Default 1000ms 256MiB

Reverse Words

Reverse Words

You are given a sentence as input. Your task is to reverse the order of the words in the sentence, while preserving the order of characters within each word. Note that leading and trailing spaces should be ignored, and words are considered to be sequences of non-space characters.

For example, given the sentence:
( \texttt{hello world this is an example} )
the correct output is:
( \texttt{example an is this world hello} ).

inputFormat

The input consists of a single line containing a sentence. The sentence may contain leading or trailing spaces and multiple spaces between words.

outputFormat

Output a single line containing the words of the sentence in reversed order. The words should be separated by a single space.## sample

hello world this is an example
example an is this world hello