直接按空格 split 成列表,然后反转按空格 join 成字符串 🤣

' '.join(input().split(' ')[::-1])