s = input()
w, lst = '', []
for i, c in enumerate(s):
if 65 <= ord(c) <= 90 or 97 <= ord(c) <= 122:
w += c
if i == len(s)-1:
lst.append(w)
else:
if w:
lst.append(w)
w = ''
for w in reversed(lst):
print(w, end=' ')