#include <bits/stdc++.h>
using namespace std;
template <typename T>
void displayVector(T v) {
  for (typename T::iterator i = v.begin(); i != v.end(); i++) {
    cout << *i << " ";
  }
  cout << endl;
}
template <typename T>
void displayMatrix(T mat) {
  for (typename T::iterator i = mat.begin(); i != mat.end(); i++) {
    displayVector(*i);
  }
  cout << endl;
}
template <typename T>
void inputVector(T &v) {
  for (typename T::iterator i = v.begin(); i != v.end(); i++) {
    cin >> *i;
  }
}
template <typename T>
void inputMatrix(T &mat) {
  for (typename T::iterator i = mat.begin(); i != mat.end(); i++) {
    inputVector(*i);
  }
}
int main() {
  long long int i, j, n, t, m, sum = 0, ans = 0, count = 0;
  string str;
  vector<vector<long long int> > mat;
  cin >> str;
  long long int len = str.size();
  ;
  char prev = str[0];
  int prevIndex = 0;
  count = 1;
  string str2;
  str2.push_back(str[0]);
  for (i = 1; i < len; i++) {
    if (str[i] == prev)
      count++;
    else {
      count = 1;
      prev = str[i];
    }
    if (count < 3) str2.push_back(str[i]);
  }
  len = str2.size();
  for (int i = 0; i < len; i++) {
    if (i + 3 < len && str2[i] == str2[i + 1] && str2[i + 2] == str2[i + 3]) {
      str2.erase(str2.begin() + i + 3);
      i--;
      len--;
    }
  }
  cout << str2 << endl;
  return 0;
}
