#C7403. Reverse Words in a Sentence

    ID: 51271 Type: Default 1000ms 256MiB

Reverse Words in a Sentence

Reverse Words in a Sentence

You are given a sentence which is a string containing words separated by spaces. Your task is to reverse each word in the sentence individually while preserving the original order of the words.

For example, given the input string:

The quick brown fox

we output:

\(ehT\ kciuq\ nworb\ xof\)

Note: The input may contain extra spaces at the beginning or the end, or between words. You should treat any sequence of whitespace as a delimiter between words. The solution will consider only non-empty words, i.e. using the standard splitting method.

Mathematically, if a sentence is composed of \(N\) words \(W_1, W_2, \dots, W_N\) where each word \(W_i\) is a sequence of characters, then the output sentence is given by:

[ Output = reverse(W_1)\ + \ " " + \ reverse(W_2)\ + \ " " + \cdots + \text{reverse}(W_N) ]

inputFormat

The input consists of a single line read from stdin containing the sentence.

outputFormat

Output a single line to stdout which is the input sentence with each word reversed while preserving the original order.

## sample
hello
olleh