题解 | #单词倒排#
单词倒排
https://www.nowcoder.com/practice/81544a4989df4109b33c2d65037c5836
import sys str= input() stack=[] word='' for ch in str: if ch.isalpha(): word+=ch elif word!="": stack.append(word) word="" if word: stack.append(word) while stack: print(stack.pop(),end=' ')