class Solution(object):
def reverseWords(self, s):
"""
:type s: str
:rtype: str
"""
nums=s.split()
# print(nums)
n=len(nums)
res=""
for x in range(n-1,-1,-1):
if x==0:
res+=nums[x]
else:
res+=nums[x]
res+=" "
return res