#K79842. Reverse Each Word

    ID: 35398 Type: Default 1000ms 256MiB

Reverse Each Word

Reverse Each Word

You are given a string s. Your task is to reverse each individual word in the string, while retaining the original order of the words.

For example, if s = "hello world", the output should be "olleh dlrow".

Note: Words are considered to be sequences of non-space characters. Consecutive spaces should be treated as a single delimiter.

The mathematical description of the problem can be formulated as follows:

\[ \text{Given } s = w_1 \ w_2 \ \cdots \ w_n, \quad \text{find } s' = \text{rev}(w_1) \ \text{rev}(w_2) \ \cdots \text{rev}(w_n), \]

where \(\text{rev}(w)\) denotes the reversal of the string w.

inputFormat

The input consists of a single line containing the string s.

The string may contain letters, digits, punctuation, and spaces. Leading or trailing spaces should be ignored.

outputFormat

Output the transformed string where each word in s is reversed, and the words appear in the same order as in the input. Note that words are separated by a single space in the output.

## sample
hello world
olleh dlrow