#C1342. Reverse Words in a String
Reverse Words in a String
Reverse Words in a String
Your task is to implement a program that reverses each individual word in a given string while maintaining the original word order. For example, given the input string "hello world", the output should be "olleh dlrow".
The program must read a single line from standard input and output the result to standard output.
The transformation applies to each word: reverse the letters of the word, but do not change the order of the words in the string.
Formally, if the input string is given by , where each is a word, then the output should be $\text{reverse}(w_1) \text{ reverse}(w_2) \dots \text{ reverse}(w_n)$.
inputFormat
Input is provided via standard input and consists of a single line containing a string . The string contains only letters and spaces.
outputFormat
Output the transformed string to standard output. Each word in the input should be reversed, but the original order of the words should remain unchanged.## sample
hello world
olleh dlrow