stack = [] s = input() for i in s: if len(stack) == 0: stack.append(i) else: if stack[-1] == i: stack.pop() else: stack.append(i) if len(stack) == 0: print("0") else: for i in stack: print(i,end='')