#C11096. Reverse Each Word in a String

    ID: 40374 Type: Default 1000ms 256MiB

Reverse Each Word in a String

Reverse Each Word in a String

Given a string (s) containing alphabetic, numeric characters and spaces, your task is to reverse the characters of each word while preserving the original order of the words and the spacing. A word is defined as a contiguous sequence of non-space characters. For example, if (s = ) "This is an example", the output should be "sihT si na elpmaxe". Note that multiple spaces (including leading and trailing spaces) must be kept intact.

inputFormat

The input is provided via stdin as a single line containing the string (s). The string may include letters, digits and spaces. All spaces including leading, trailing, or multiple spaces between words must be preserved.

outputFormat

Output the transformed string on stdout, where each word's characters are reversed while the overall spacing remains unchanged.## sample

hello
olleh