import re
'''s = input()
for i in s:
if ('a'<= i <= 'z' or 'A' <= i <= 'Z') == False:
i = ' ' # 不知道这样为啥不能替换掉非字母字符
ss = s.split(' ')
ss1 = ss[::-1]
ss2 = ' '.join(ss1)
print(ss2)'''
s = input()
'''for i in s:
if ord('a')<= ord(i) <= ord('z'):
pass
elif ord('A') <= ord(i) <= ord('Z'):
pass
else:
s.replace(i, '*')''' # 不知道这样为啥不能替换掉非字母字符
s = re.sub(r'([^a-zA-Z])', ' ', s) # 将非字母子串替换成空格
ss = s.split(' ')
ss1 = ss[::-1]
ss2 = ' '.join(ss1)
print(ss2)