#K58707. Reverse Each Word
Reverse Each Word
Reverse Each Word
You are given a sentence. Your task is to reverse each word in the sentence individually while maintaining the original order of the words.
For example, if the sentence is Hello World
, then the output should be olleH dlroW
.
The sentence may contain multiple spaces. When processing, consider only the non-space characters as part of a word. Process multiple test cases accordingly.
inputFormat
The first line contains an integer T representing the number of test cases. Each of the following T lines contains a string, which represents a sentence possibly including spaces.
outputFormat
For each test case, print a line that contains the sentence with each word reversed. Even if the input contains multiple spaces, words in the output should be separated by a single space.
## sample3
Hello World
Python is fun
A quick brown fox
olleH dlroW
nohtyP si nuf
A kciuq nworb xof
</p>