#C14409. Reverse Words in a String
Reverse Words in a String
Reverse Words in a String
You are given a string s
. Your task is to reverse the characters of each word while keeping the original order of the words intact.
A word is defined as a maximal sequence of non-space characters. Any extra spaces in the input should be ignored in the output (i.e. words should be separated by a single space).
For example, if s = "Hello World"
, then the output should be "olleH dlroW"
.
Note: If the input string is empty or consists only of spaces, the output should be an empty string.
inputFormat
The input consists of a single line containing the string s
. The string may contain letters, numbers, punctuation, and extra spaces.
outputFormat
Output the resulting string after reversing each word’s characters. Words in the output should be separated by a single space.
## sampleHello
olleH