#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007ll;
inline void print(char pt) { printf("%c\n", pt); }
inline void print(int pt) { printf("%d\n", pt); }
inline void print(long long pt) { printf("%I64d\n", pt); }
inline void print(double pt) { printf("%f\n", pt); }
inline void print(char pt[]) { printf("%s\n", pt); }
inline void scan(int &pt) { scanf("%d", &pt); }
inline void scan(char &pt) { scanf("%c", &pt); }
inline void scan(long long &pt) { scanf("%I64d", &pt); }
inline void scan(double &pt) { scanf("%lf", &pt); }
inline void scan(char pt[]) { scanf("%s", pt); }
struct pii {
  int a;
  int b;
  friend int operator<(pii a, pii b) {
    if (a.a != b.a) return a.a < b.a;
    return a.b > b.b;
  }
};
struct str {
  char val[200];
  str() { memset(val, 0, sizeof(val)); }
  friend int operator<(str a, str b) { return strcmp(a.val, b.val) < 0; }
};
long long gcd(long long x, long long y) { return y ? gcd(y, x % y) : x; }
long long lcm(long long x, long long y) { return x * (y / gcd(x, y)); }
int bits[50];
void getbits() {
  for (int i = 0; i < 30; i++) {
    bits[i] = 1 << i;
  }
}
struct piii {
  int li;
  int ri;
  int l1;
  int l2;
  int r1;
  int r2;
  friend int operator<(piii a, piii b) { return a.li < b.li; }
};
long long Q_pow(long long x, long long y) {
  long long res = 1;
  while (y) {
    if (y % 2 == 1) {
      res *= x;
      res %= MOD;
    }
    x = x * x;
    x %= MOD;
    y /= 2;
  }
  return res;
}
long long extend_gcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0 && b == 0) return -1;
  if (b == 0) {
    x = 1;
    y = 0;
    return a;
  }
  long long d = extend_gcd(b, a % b, y, x);
  y -= a / b * x;
  return d;
}
long long mod_reverse(long long a, long long MOD) {
  long long x, y;
  long long d = extend_gcd(a, MOD, x, y);
  if (d == 1)
    return (x % MOD + MOD) % MOD;
  else
    return -1;
}
int tmp;
int n, m, k;
char stra[200005];
int lasta[200005];
int nexta[200005];
int main() {
  scan(stra);
  int lena = strlen(stra);
  for (int i = 0; i < lena; i++) {
    lasta[i] = i - 1;
    nexta[i] = i + 1;
  }
  int biginposa = 0;
  for (int i = 0; i < lena;) {
    if (stra[i] == stra[nexta[i]]) {
      if (lasta[i] == -1) {
        biginposa = nexta[nexta[i]];
        lasta[biginposa] = -1;
        i = biginposa;
        continue;
      } else {
        nexta[lasta[i]] = nexta[nexta[i]];
        lasta[nexta[nexta[i]]] = lasta[i];
        i = lasta[i];
        continue;
      }
    } else {
      i = nexta[i];
    }
  }
  for (int i = biginposa; i < lena; i = nexta[i]) {
    printf("%c", stra[i]);
  }
  print("");
  return 0;
}
