#K10381. Reverse Alternating Words
Reverse Alternating Words
Reverse Alternating Words
You are given a string s. Your task is to reverse every alternate word in the string starting from the second word. In other words, for words positioned at indices 1, 3, 5, \( \ldots \), reverse the characters in each word, while leaving the other words unchanged.
For example, if \( s = "hello world" \), then the output should be "hello dlrow". The program should read input from standard input (stdin) and output the result to standard output (stdout).
Note: The words are separated by spaces, and the input consists of a single line. If the input string is empty, the output should also be an empty string.
inputFormat
The input is a single line containing the string \( s \).
outputFormat
The output is a single line containing the modified string after reversing every alternate word starting from the second word.
## samplehello world
hello dlrow