Reverse Each Word
Words in s are separated by single spaces. Return a string where the letters of each word are reversed, but the words stay in the same order and the spaces stay where they were.
Example 1
s "Let us code"
returns "teL su edoc"
Each word flips on its own: teL su edoc.
Constraints
1 <= len(s) <= 100- Words are separated by exactly one space, with no space at the start or end
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Strings problems
- Reverse Prefix of WordBeginner
- Reverse StringBeginner
- Snake Case to Camel CaseBeginner
- Stretch Each CharacterBeginner
- Student Attendance RecordBeginner
- Sum of Digits in TextBeginner
- Truncate SentenceBeginner
- Two String Lists Spell the Same WordBeginner