import sys

stack = []
for line in sys.stdin:
    line = line.strip()  # 去除行末尾的换行符,否则换行符也算作一个字符导致栈不为空
    for s in line:
        if stack and stack[-1] == s:
            stack.pop()
        else: 
            stack.append(s)
        
if not stack:
    print(0)
else:
    for c in stack:
        print(c, end="")