Question
Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Example 1:
Input: s = "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc"
Example 2:
Input: s = "God Ding" Output: "doG gniD"
Constraints:
1 <= s.length <= 5 * 104scontains printable ASCII characters.sdoes not contain any leading or trailing spaces.- There is at least one word in
s. - All the words in
sare separated by a single space.
Python Solution
class Solution:
def reverseWords(self, s: str) -> str:
s = s.split()
for i in range(len(s)):
s[i]=s[i][::-1]
return (' '.join(s))

![[Solved] You are given an integer n and an integer start. Define an array nums where nums[i] = start + 2 * i (0-indexed) and n == nums.length. Return the bitwise XOR of all elements of nums.](https://machinelearningprojects.net/wp-content/uploads/2022/09/Leetcode-solutions-MLP-Feature-Image-1024x536.webp)