#557
Reverse Words in a String III
newbie · 130 · lc easy +13 · verified · 83.9% accepted · 6,206 likes · top 95%
Description
Given a string s representing a sentence, reverse the characters within each individual word while keeping the words themselves in their original order and preserving all spacing.
Example 1:
Input: s = "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"
Example 2:
Input: s = "Mr Ding"
Output: "rM gniD"
Code
1
2
3