题解 | #单词倒排#
单词倒排
http://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
a = str(input())
lst1 = list(a)
len1 = len(lst1)
lst2 = []
def judgezimu(a):
if((ord(a)>=65 and ord(a)<=90) or (ord(a)>=97 and ord(a)<=122)):
return True
else:
return False
b=""
for i in range(0,len1):
if judgezimu(lst1[i]) is True:
b+=lst1[i]
if i==(len1-1):
lst2.append(b)
else:
if b != "":
lst2.append(b)
b=""
continue
for i in range(len(lst2)):
print(lst2[len(lst2)-i-1],end=" ")