words = input()
for letter in words:
if not letter.isalpha(): # 判断非字母
words = words.replace(letter, " ") # 使用间隔(空格)替换
new_words = (words.split())[::-1] # 切片字符串返回列表,使用倒序
for i in new_words:
print(i, end=" ") # 输出,使用空格间隔
words = input()
for letter in words:
if not letter.isalpha(): # 判断非字母
words = words.replace(letter, " ") # 使用间隔(空格)替换
new_words = (words.split())[::-1] # 切片字符串返回列表,使用倒序
for i in new_words:
print(i, end=" ") # 输出,使用空格间隔