s = input().split()		#分隔输入为列表
n = s[::-1]				#将列表元素逆序
for word in n:
    print(word,end=" ")

思路见代码注释!

太简单了!