问题描述:
Given an input string, reverse the string word by word.
For example,
Given s = "the sky is blue",
return "blue is sky the".
解决方案:
class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
s_list = s.strip().split()
re_s_list = s_list[::-1]
return " ".join(re_s_list)