All problems

Problem 327

Reverse Each Word

Easy · 10 pts · String, Two Pointers

Problem

A sentence consists of words separated by single spaces. Reverse the letters inside every word, but keep the words themselves in their original order. For example, 'Let us code' becomes 'teL su edoc'. Punctuation and digits that are part of a word are reversed together with its letters.

Input

A single line: words of printable characters separated by single spaces.

Output

Print the sentence with every word reversed.

Constraints

1 <= length of the line <= 100000

Example input

Let's take a contest

Example output

s'teL ekat a tsetnoc

Explanation

Each word of 'Let's take a contest' is reversed on its own: "s'teL ekat a tsetnoc".

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: Minimum Swaps to Balance Brackets Next: Sort Characters by Frequency