#K35897. Reverse the Characters in Each Word
Reverse the Characters in Each Word
Reverse the Characters in Each Word
Given a string consisting of words separated by whitespace, your task is to reverse the characters in each word, while keeping the order of the words intact. For example, if the input string is hello world
, the expected output is olleh dlrow
.
The input will be provided as a single line via standard input, and your program should print the resulting string to standard output.
Note: Each word is considered as a maximal substring consisting of non-space characters. The transformation does not change the number of words; it only reverses the characters within each word.
inputFormat
The input is a single line containing the string. The string may include letters, punctuation, digits, and spaces. Words are separated by one or more whitespace characters.
outputFormat
Output a single line containing the transformed string, where the characters in each individual word are reversed and words are separated by a single space.
## samplehello world
olleh dlrow
</p>