题解 | 单词倒排
单词倒排
https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
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)
联想公司福利 1523人发布
查看14道真题和解析