import sys import re sentence = input() sentence = re.split(r'\W+', sentence) # 以非字母分割字符串 sentence = ' '.join(reversed(sentence)) for i in sentence: if ord(i) < 65 or (90 < ord(i) < 97) or ord(i) > 122: #既不是大写字母也不是小写字母 sentence = sentence.replace(i, " ") print(sentence)