#K34367. Reverse Each Word
Reverse Each Word
Reverse Each Word
Given a string consisting of words separated by spaces, your task is to reverse each word individually while preserving the original order of the words.
Note that the input string may contain leading or trailing spaces and multiple consecutive spaces. Each word should be reversed in its character order, but the spaces should remain in their original positions.
For instance, if the input is " abc def ghi "
, the output should be " cba fed ihg "
.
Hint: Consider that splitting the string by the space character will keep empty tokens representing extra spaces.
inputFormat
The input is provided via standard input (stdin) as a single line containing a string. The string may include spaces, and these spaces must be preserved in the output.
outputFormat
Output the transformed string to standard output (stdout) where each word has its characters reversed, but the order of the words remains unchanged.
## samplehello
olleh