import sys

str=input()

list1=[]
for char in str:
    if len(list1)==0:
        list1.append(char)
    elif len(list1)>=1 and list1[-1]!=char:
        list1.append(char)
    elif len(list1)>=1 and list1[-1]==char:
        list1.pop()
if len(list1)==0:
    print(0)
else:
    print(''.join(list1))