9956번 - Reversing Words

시간 제한

메모리 제한

제출

정답

맞은 사람

정답 비율

1 초

128 MB

1

1

1

100.000%

문제

“Oh no, not another reversing problem! We did those in Programming 101, years ago”, I hear you cry. Well yes, but this problem is just a little different, in that you have to reverse individual words, not entire sentences. Furthermore, only the letters are to be reversed — spaces, punctuation and case are unaffected.

For this problem a word is defined to be a sequence of characters containing at least two letters and delimited by whitespace. The letters in the word must be written in reverse order (so 'the' becomes 'eht'), but the other characters in the word remain in their original sequence. Furthermore, if a character in the original word is upper-case, the letter in the same position in the new word must also be uppercase, thus 'Smith-Jones' becomes 'Senoj-Htims'. The position of the word in the line must be unaltered, and the position of every non-letter must also be unaltered (so double blanks remain as double blanks).

입력

Input will be a series of lines, terminated by a line consisting of a single '#'. No line will have more than 80 characters.

출력

Output will consist of a series of lines, one for each line in the input, with the letters in each word reversed as described above.