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>
const int MX = 5e4 + 233;
const long long MOD = 998244853;
const long long base = 114514;
int read() {
  char k = getchar();
  int x = 0;
  while (k < '0' || k > '9') k = getchar();
  while (k >= '0' && k <= '9') x = x * 10 + k - '0', k = getchar();
  return x;
}
char str[MX];
int n;
long long pre[MX], suf[MX];
long long pwbase[MX];
void init() {
  pwbase[0] = 1;
  for (int i = 1; i < MX; ++i) pwbase[i] = pwbase[i - 1] * base % MOD;
}
long long getpre(int l, int r) {
  long long ret = (pre[r] - pre[l - 1] * pwbase[r - l + 1] % MOD + MOD) % MOD;
  return ret;
}
long long getsuf(int l, int r) {
  long long ret = (suf[l] - suf[r + 1] * pwbase[r - l + 1] % MOD + MOD) % MOD;
  return ret;
}
long long LCP(int k1, int k2) {
  int l = 0, r = n - k2 + 1, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (getsuf(k1, k1 + mid - 1) == getsuf(k2, k2 + mid - 1))
      l = mid + 1;
    else
      r = mid - 1;
  }
  return l - 1;
}
long long LCS(int k1, int k2) {
  int l = 0, r = k1, mid;
  while (l <= r) {
    mid = (l + r) >> 1;
    if (getpre(k1 - mid + 1, k1) == getpre(k2 - mid + 1, k2))
      l = mid + 1;
    else
      r = mid - 1;
    ;
  }
  return l - 1;
}
void dohash() {
  memset(pre, 0, sizeof pre);
  memset(suf, 0, sizeof suf);
  for (int i = 1; i <= n; ++i) pre[i] = (pre[i - 1] * base + str[i]) % MOD;
  for (int i = n; i >= 1; --i) suf[i] = (suf[i + 1] * base + str[i]) % MOD;
}
int use[MX];
int main() {
  init();
  scanf("%s", str + 1);
  n = strlen(str + 1);
  dohash();
  for (int i = 1; i <= n; ++i) {
    int change = 0;
    int limL = 0;
    for (int j = i; j + i <= n; j += i) {
      int lcp = LCP(j, j + i), lcs = LCS(j, j + i);
      lcs = std::min(lcs, j - limL + 1);
      if (lcs + lcp - 1 >= i) {
        change = 1;
        limL = j - lcs + 1 + i;
        for (int k = j - lcs + 1; k < j - lcs + 1 + i; ++k) {
          use[k] = 1;
        }
      }
    }
    if (change) {
      int j = 0;
      for (int i = 1; i <= n; ++i) {
        if (!use[i]) str[++j] = str[i];
        use[i] = 0;
      }
      str[j + 1] = 0;
      n = j;
      dohash();
    }
  }
  puts(str + 1);
  return 0;
}