s = input() stack = [] for i in s: if not stack : stack.append(i) else : if stack[-1] == i : stack.pop(-1) else : stack.append(i) if not stack : print(0) else : print("".join(stack))