words = [] while 1: x = input() if x == '0': break else: words.append(x) print(" ".join(words)) # 以空格间隔开 # 重要的while逻辑