第11个点居然输入空字符串卡我
直接try特判
class Solution(object):
def reverseWords(self, s):
try:
a=s.split()
b=""
for i in range(1,len(a)):
b=str(b)+str(a[-int(i)])+" "
return str(b)+a[0]
except:
return ""