#K6311. Reverse Each Word in a Sentence
Reverse Each Word in a Sentence
Reverse Each Word in a Sentence
Given a string sentence, reverse the characters in each word while maintaining the original order of the words.
For example, if the input is "Pirates are cunning and ferocious", the output should be "setariP era gninnuc dna suoicoref".
Note that any leading or trailing spaces should be ignored, and words are separated by one or more whitespace characters.
This problem may appear in many coding interviews and contests. Make sure your solution reads from standard input (stdin) and writes to standard output (stdout).
inputFormat
The input consists of a single line containing a string sentence which may include letters, punctuation, and spaces.
Leading and trailing spaces, if any, should be ignored.
outputFormat
Output the modified string where each word is reversed but the word order remains unchanged.
The resulting string should not have any extra leading or trailing spaces.
## samplePirates are cunning and ferocious
setariP era gninnuc dna suoicoref