#K12221. Reverse Each Word in a Sentence

    ID: 23643 Type: Default 1000ms 256MiB

Reverse Each Word in a Sentence

Reverse Each Word in a Sentence

Given a sentence represented as a string, your task is to reverse each word individually while maintaining their original order. More formally, if the sentence is given as \( s = w_1\, w_2\, \dots\, w_n \), then the output should be \( [\text{reverse}(w_1)]\ [\text{reverse}(w_2)]\ \dots\ [\text{reverse}(w_n)] \).

The sentence will be composed of English letters, punctuation, and spaces. Note that any extra spaces (leading, trailing, or in-between) are removed, as words are determined by splitting on whitespace.

inputFormat

The input consists of a single line, which is a non-empty or empty sentence. The sentence may include letters, punctuation, and multiple spaces. Input is provided via standard input (stdin).

outputFormat

Output the sentence with each word reversed while preserving the original order of words. The result should be printed to standard output (stdout).## sample

The quick brown fox
ehT kciuq nworb xof