def xiaochu(s):
    l = ''
    for i in s:
        l = l + i
        if len(l)>1 and l[-1]==l[-2]:
            l = l[:-2]
    return l if l else 0
print(xiaochu(input()))