题解 | #单词倒排#
单词倒排
https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
import re x = list(str(input())) y = [] for i in x: if re.search(r'[^a-zA-Z]+', i) is not None: y.append(' ') else: y.append(i) y = ''.join(y).split(' ') y = list(reversed(y)) y = ' '.join(y) print(y)