#C12805. Reverse Words Preserving Spaces
Reverse Words Preserving Spaces
Reverse Words Preserving Spaces
In this problem, you are given a string that contains words and spaces. Your task is to reverse the letters of each word individually while keeping the spaces at their original positions.
A word is defined as a maximal consecutive sequence of non-space characters. The spaces between words, including multiple consecutive spaces, must remain unchanged in the output.
For example, if the input is "hello world", then the output should be "olleh dlrow". Similarly, if the input is "keep the elements aligned", the output should be "peek eht stnemele dengila".
Note: The output should be printed to standard output.
inputFormat
The input consists of a single line containing a string s which may include spaces and printable characters.
outputFormat
Output the processed string after reversing individual words while keeping the spaces in their original positions.
## samplehello world
olleh dlrow