题解 | #单词倒排#
单词倒排
http://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
n = input().split()#字符串转列表 n = str(n[::]).replace("'", "").replace(",", "").replace("[", "").replace("]", "")#列表转字符串,删除 for i in range(len(n)): if not n[i].isalpha(): n = str(n).replace(n[i]," ") n = n.split(" ") n = str(n[::-1]).replace("'", "").replace(",", "").replace("[", "").replace("]", "") print(n)