Python | Leetcode Python题解之第557题反转字符串中的单词III
题目:
题解:
class Solution:
def reverseWords(self, s: str) -> str:
stack, res, s = [], "", s + " "
for i in s:
stack.append(i)
if i == " ":
while(stack):
res += stack.pop()
return res[1:]