#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long n, p, i, sum, r, j;
  vector<long long> v;
  vector<char> l, m;
  cin >> s;
  n = s.length();
  p = 1;
  for (i = 0; i < n - 1; i++) {
    if (s[i] == s[i + 1]) {
      p++;
    } else {
      v.push_back(p);
      p = 1;
    }
  }
  v.push_back(p);
  sum = 0;
  for (i = 0; i < v.size(); i++) {
    if (v[i] > 2 && v[i + 1] < 2 && i < v.size() - 1) {
      l.push_back(s[sum]);
      l.push_back(s[sum]);
      sum += v[i];
    } else if (v[i] >= 2 && v[i + 1] >= 2 && i < v.size() - 1) {
      l.push_back(s[sum]);
      l.push_back(s[sum]);
      l.push_back(s[sum + v[i]]);
      sum += v[i] + v[i + 1];
      i++;
    } else if (v[i] >= 2) {
      l.push_back(s[sum]);
      l.push_back(s[sum]);
      sum += v[i];
    } else {
      l.push_back(s[sum]);
      sum++;
    }
  }
  sum = n - 1;
  for (i = v.size() - 1; i >= 0; i--) {
    if (v[i] > 2 && v[i - 1] < 2 && i >= 1) {
      m.push_back(s[sum]);
      m.push_back(s[sum]);
      sum -= v[i];
    } else if (v[i] >= 2 && v[i - 1] >= 2 && i >= 1) {
      m.push_back(s[sum]);
      m.push_back(s[sum]);
      m.push_back(s[sum - v[i]]);
      sum -= v[i] + v[i - 1];
      i--;
    } else if (v[i] >= 2) {
      m.push_back(s[sum]);
      m.push_back(s[sum]);
      sum -= v[i];
    } else {
      m.push_back(s[sum]);
      sum--;
    }
  }
  if (l.size() >= m.size()) {
    for (i = 0; i < l.size(); i++) {
      cout << l[i];
    }
  } else {
    reverse(m.begin(), m.end());
    for (i = 0; i < m.size(); i++) {
      cout << m[i];
    }
  }
}
