import re n = input() t=re.sub('\W+',' ' ,n) #print(t) m=' '.join((t.split(' ')[::-1])) print(m.rstrip())

re模块还是不会用,感觉写复杂了