Given a string s, reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.
Input: s = "Let's take LeetCode contest"
Output: "s'teL ekat edoCteeL tsetnoc"
Input: s = "Mr Ding"
Output: "rM gniD"
class Solution:
def reverseWords(self, s: str) -> str:
result = ""
temp = ""
for i in range(0, len(s)):
if s[i] == ' ':
result = result + temp + " "
temp = ""
else:
temp = s[i] + temp
result += temp
return result
class Solution:
def reverseWords(self, s: str) -> str:
sList = s.split()
for i in range(0, len(sList)):
sList[i] = sList[i][::-1]
return ' '.join(sList)

