#include <bits/stdc++.h>
using namespace std;
;
char discard[200010];
int main() {
  string x;
  cin >> x;
  if ((int)x.size() < 3) {
    cout << x << endl;
  } else {
    int k = 2;
    while (x[k - 2] == x[k - 1] && x[k - 1] == x[k]) {
      if (k == (int)x.size()) break;
      discard[k - 2] = -1;
      k++;
    }
    int slw[3] = {k - 2, k - 1, k};
    for (int i = k + 1; i < (int)x.size(); ++i) {
      if (x[i] == x[slw[2]] && x[i] == x[slw[1]]) {
        discard[i] = -1;
      } else if (x[slw[0]] == x[slw[1]] && x[slw[2]] == x[i]) {
        discard[i] = -1;
      } else {
        slw[0] = slw[1];
        slw[1] = slw[2];
        slw[2] = i;
      }
    }
    for (int i = 0; i < (int)x.size(); ++i) {
      if (!discard[i]) cout << x[i];
    }
    cout << endl;
  }
  return 0;
}
