#K52772. Reverse Each Word

    ID: 29384 Type: Default 1000ms 256MiB

Reverse Each Word

Reverse Each Word

Given a string, your task is to reverse each individual word while preserving the original order of the words.

For example, if the input is Hello World, the output should be olleH dlroW. Note that multiple spaces should be treated as a single delimiter, and the leading or trailing spaces are ignored.

You can consider the problem mathematically as: given a string \(s\) that can be split into words \(s = w_1 \; w_2 \; \ldots \; w_n\), produce the output as \(reverse(w_1) \; reverse(w_2) \; \ldots \; reverse(w_n)\).

inputFormat

The input is provided via stdin as a single line string. It may contain leading and trailing spaces, and words are separated by one or more spaces.

outputFormat

Output the transformed string to stdout where each word is reversed but the word order remains unchanged. The words in the output should be separated by a single space.

## sample
Hello World Example
olleH dlroW elpmaxE