a = list(map(int,input().split())) l = len(a) i = 0 while i<l-1: if a[i+1]==0: del a[i] l = l-1 i = i-1 i = i+1 for x in a: print(x, end=' ')