#include <bits/stdc++.h>
using namespace std;
const long long int INF = 98769876987698889LL;
const int MOD = 1e9 + 7;
const int dx8[] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy8[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int dx4[] = {1, -1, 0, 0};
const int dy4[] = {0, 0, 1, -1};
const int N = 1e5 + 5;
vector<pair<int, char> > v, v1;
string s;
string ans = "", ans2 = "";
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> s;
  s = s + '.';
  if (s.length() == 1) {
    cout << s << endl;
    return 0;
  }
  int c = 1;
  char cur = s[0];
  for (int i = 1; i < s.length(); ++i) {
    if (s[i] == s[i - 1]) {
      ++c;
    } else {
      if (c > 2) c = 2;
      v.push_back(make_pair(c, cur));
      c = 1;
      cur = s[i];
    }
  }
  v.push_back(make_pair(0, '.'));
  for (int i = 0; i < v.size() - 1; ++i) {
    if (v[i].first == 1) continue;
    if (v[i].first == 2 and v[i + 1].first > 1) {
      v[i + 1].first = 1;
    } else if (v[i].first > 2 and v[i + 1].first < 2) {
      v[i].first = 2;
    } else if (v[i].first > 2 and v[i + 1].first >= 2) {
      v[i].first = 1;
    }
  }
  for (int i = 0; i < v.size() - 1; ++i) {
    for (int j = 0; j < v[i].first; ++j) {
      ans.push_back(v[i].second);
    }
  }
  cout << ans;
}
