//  #牛客春招刷题训练营# https://www.nowcoder.com/discuss/726480854079250432
//  我也不知道怎么写这篇题解因为这应该是一个标准做法,不过没有见过的话可能会想不到
#include <iostream>
#include <stack>
using namespace std;

int main() {
  ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
  stack<char> a;
  char c;
  while(cin >> c){
    if (a.empty())
      a.push(c);
    else if (c == a.top())
      a.pop();
    else
      a.push(c);
  }
  stack<char> b;
  if (a.empty()){
    cout << 0;
    return 0;
  }
  while(!a.empty()){
    b.push(a.top());
    a.pop();
  }
  while(!b.empty()){
    cout << b.top();
    b.pop();
  }
}
// 64 位输出请用 printf("%lld")