lst = list(map(int, input().split()))

for i in range(len(lst)):
    ans = lst[i]
    if i < len(lst) - 1:
        if lst[i + 1] == 0:
            continue
        else:
            print(ans, end = ' ')
    else:
        print(ans)