#include <bits/stdc++.h>
#pragma optimize("Ofast")
using namespace std;
using ll = long long;
const int N = 1e5 + 5;
int main() {
  ios_base::sync_with_stdio(0);
  string s;
  cin >> s;
  s += "#";
  int c = 1;
  vector<int> d;
  for (int i = 1; i < s.size(); ++i) {
    if (s[i] == s[i - 1]) {
      while (i < s.size() && s[i] == s[i - 1]) {
        ++c;
        ++i;
      }
      d.push_back(c);
      --i;
      c = 0;
    } else {
      if (c) d.push_back(c);
      c = 1;
    }
  }
  int i = 0, sum = 0, prev = 0;
  string ans = "";
  for (auto it : d) {
    if (it == 1) {
      ans += s[i++];
      prev = false;
    } else if (it == 2) {
      if (prev) {
        prev = false;
        ans += s[i++];
      } else {
        ans += s[i++];
        ans += s[i++];
        prev = true;
      }
    } else {
      if (prev) {
        prev = false;
        ans += s[i++];
      } else {
        ans += s[i++];
        ans += s[i++];
        prev = true;
      }
    }
    sum += it;
    i = sum;
  }
  cout << ans << "\n";
  return 0;
}
