344、反转字符串
class Solution:
def reverseString(self, s: List[str]) -> None:
"""
Do not return anything, modify s in-place instead.
"""
i, j = 0, len(s)-1
while i < j:
s[i], s[j] = s[j], s[i]
i += 1
j -= 1
557、反转字符串中的单词3
class Solution:
def reverseWords(self, s: str) -> str:
return ' '.join(i[::-1] for i in s.split())