Problem: A substring of a string is a contiguous subsequence of that string. So, string bca is substring of string abcabc, but string cc is not.

A repeating block is a string formed by concatenating some string with itself. So, string abcabc is a repeating block, but strings abcabd, ababab are not.

You've got a sequence of Latin characters (string). At each step you find the shortest substring that is a repeating block, if there exists more than one you must choose the leftmost. As the substring is of form XX (X — some string) you replace this substring with X, in other words you delete one of the X substrings in the substring. You repeat this process until there remains no repeating block in the string. 

How would the final string looks like? Look at the sample explanation to understand the statement more precise.

Input

In the first line of input you're given a string of small Latin characters with length between 1 to 50000, inclusive.

Output

Print the final string after applying changes.

Examples

Input

abccabc


Output

abc


Input

aaaabaaab


Output

ab


Input

birdbirdbirdistheword


Output

birdistheword

Note

At the first sample the string transforms as follows: abccabc →  abcabc →  abc.

At the second sample the string transforms as follows: aaaabaaab →  aaabaaab →  aabaaab →  abaaab →  abaab →  abab →  ab.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <typename T>
void read(T &x) {
  x = 0;
  char ch = getchar();
  long long f = 1;
  while (!isdigit(ch)) {
    if (ch == '-') f *= -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - 48;
    ch = getchar();
  }
  x *= f;
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
const int N = 50010;
char s[N], t[N];
long long base1 = 233, base2 = 2333;
long long MOD1 = 1e9 + 7, MOD2 = 1e9 + 9;
long long h1[N], h2[N];
long long p1[N], p2[N];
void pre(int);
long long cal(int, int);
int cal_lcp(int, int, int);
int cal_lcs(int, int, int);
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  cin >> s + 1;
  int n = strlen(s + 1);
  pre(50000);
  bool fuck = true;
  for (int len = 1; len * 2 <= n; ++len) {
    if (fuck) {
      for (int i = 1; i <= n; ++i) {
        h1[i] = (h1[i - 1] * base1 + s[i]) % MOD1;
        h2[i] = (h2[i - 1] * base2 + s[i]) % MOD2;
      }
    }
    fuck = false;
    int pre = -1;
    vector<pair<int, int> > v;
    for (int i = 1, j = i + len; j <= n; i += len, j += len) {
      int lcp = cal_lcp(i, j, n - j + 1);
      int lcs = cal_lcs(i, j, i);
      if (lcp + lcs <= len) continue;
      int l = i - lcs + 1, r = j + lcp - 1;
      if (l == pre) continue;
      pre = l;
      v.push_back({l, 1});
      while (l + 2 * len - 1 <= r) l += len;
      v.push_back({l, -1});
      fuck = true;
    }
    if (fuck) {
      int nw = 0;
      int cnt = 0;
      sort(v.begin(), v.end());
      for (int i = 1, j = 0; i <= n; ++i) {
        while (j < v.size() && i == v[j].first) cnt += v[j++].second;
        if (cnt == 0) t[++nw] = s[i];
      }
      t[nw + 1] = '\0';
      swap(s, t);
      n = nw;
    }
  }
  cout << s + 1;
  return 0;
}
void pre(int n) {
  p1[0] = p2[0] = 1;
  h1[0] = h2[0] = 0;
  for (int i = 1; i <= n; ++i) {
    p1[i] = (p1[i - 1] * base1) % MOD1;
    p2[i] = (p2[i - 1] * base2) % MOD2;
  }
}
long long cal(int l, int r) {
  long long ret1 = ((h1[r] - h1[l - 1] * p1[r - l + 1] % MOD1) + MOD1) % MOD1;
  long long ret2 = ((h2[r] - h2[l - 1] * p2[r - l + 1] % MOD2) + MOD2) % MOD2;
  return ret1 * MOD2 + ret2;
}
int cal_lcp(int x, int y, int r) {
  int l = 1;
  while (l <= r) {
    int mid = l + r >> 1;
    if (cal(x, x + mid - 1) != cal(y, y + mid - 1))
      r = mid - 1;
    else
      l = mid + 1;
  }
  return l - 1;
}
int cal_lcs(int x, int y, int r) {
  int l = 1;
  while (l <= r) {
    int mid = l + r >> 1;
    if (cal(x - mid + 1, x) != cal(y - mid + 1, y))
      r = mid - 1;
    else
      l = mid + 1;
  }
  return l - 1;
}