#K33162. Reverse Words

    ID: 25027 Type: Default 1000ms 256MiB

Reverse Words

Reverse Words

You are given a string s which may contain leading or trailing spaces and extra spaces between words. Your task is to reverse the order of the words in the string and ensure that words are separated by a single space only.

Note: The input string should be processed so that any extra spaces are removed, and the final string contains exactly one space between words.

For example, if the input is " the sky is blue ", the output should be "blue is sky the".

inputFormat

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

outputFormat

Output the string with the words in reverse order. The output should be written to stdout.

## sample
  the sky  is   blue  
blue is sky the