#include <bits/stdc++.h>
using namespace std;
int isPrime(long long int n) {
  if (n <= 1) return 0;
  for (long long int i = 2; i < n; i++)
    if (n % i == 0) return 0;
  return 1;
}
long long int modFact(long long int n, long long int p) {
  if (n >= p) return 0;
  long long int result = 1;
  for (long long int i = 1; i <= n; i++) result = (result * i) % p;
  return result;
}
long long int countDivisors(long long int n) {
  long long int cnt = 0;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        cnt++;
      else
        cnt = cnt + 2;
    }
  }
  return cnt;
}
bool isSubSequence(string str1, string str2, long long int m, long long int n) {
  if (m == 0) return true;
  if (n == 0) return false;
  if (str1[m - 1] == str2[n - 1])
    return isSubSequence(str1, str2, m - 1, n - 1);
  return isSubSequence(str1, str2, m, n - 1);
}
bool isPerfectSquare(long double x) {
  long double sr = sqrt(x);
  return ((sr - floor(sr)) == 0);
}
long long int isSubstring(string s1, string s2) {
  long long int M = s1.length();
  long long int N = s2.length();
  for (long long int i = 0; i <= N - M; i++) {
    long long int j;
    for (j = 0; j < M; j++)
      if (s2[i + j] != s1[j]) break;
    if (j == M) return i;
  }
  return -1;
}
long long int countFreq(string &pat, string &txt) {
  long long int M = pat.length();
  long long int N = txt.length();
  long long int res = 0;
  for (long long int i = 0; i <= N - M; i++) {
    long long int j;
    for (j = 0; j < M; j++)
      if (txt[i + j] != pat[j]) break;
    if (j == M) {
      res++;
      j = 0;
    }
  }
  return res;
}
long long int modularExponentiation(long long int x, long long int n,
                                    long long int M) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x) % M, n / 2, M);
  else
    return (x * modularExponentiation((x * x) % M, (n - 1) / 2, M)) % M;
}
long long int factorial(long long int n) {
  if (n < 0) return (-1);
  if (n == 0)
    return (1);
  else {
    return (n * factorial(n - 1));
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  string s;
  cin >> s;
  if (s.length() <= 2)
    cout << s;
  else if (s.length() == 3) {
    if (s[0] == s[1] && s[1] == s[2]) {
      cout << s[0] << s[1];
    } else
      cout << s;
  } else {
    for (long long int i = 0; i < s.length() - 3; i++) {
      if (s[i] == s[i + 1] && s[i + 1] == s[i + 2]) {
        s.erase(i, 1);
        i--;
      }
    }
    for (long long int i = 0; i < s.length() - 3; i++) {
      if (s[i] == s[i + 1] && s[i + 2] == s[i + 3]) {
        if (i < s.length() - 5) {
          if (s[i + 4] == s[i + 5]) {
            s.erase(i + 2, 1);
            i--;
          } else {
            s.erase(i, 1);
            i--;
          }
        } else {
          s.erase(i, 1);
          i--;
        }
      }
    }
    if (s[s.length() - 1] == s[s.length() - 2] &&
        s[s.length() - 1] == s[s.length() - 3])
      s.erase(s.length() - 1, 1);
    cout << s;
  }
  return 0;
}
