#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  s += '0';
  int j = 1, p = -3;
  for (int i = 1; i < s.length(); i++) {
    if (s[i] == s[i - 1])
      j++;
    else if (s[i] != s[i - 1] && j > 1) {
      if (j == 2) {
        if (p + 2 == i - 1) {
          s[i - 1] = '0';
          j = 1;
        } else
          p = i - 1;
      } else if (j > 2) {
        for (int k = i - j; k < i - 2; k++) {
          s[k] = '0';
        }
        if (p + j == i - 1)
          s[i - 1] = '0';
        else
          p = i - 1;
      }
      j = 1;
    }
  }
  for (int i = 0; i < s.length(); i++) {
    if (s[i] != '0') printf("%c", s[i]);
  }
}
