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>
using namespace std;
template <typename T>
inline void read(T& x) {
  int f;
  char c;
  for (f = 1, c = getchar(); c < '0' || c > '9'; c = getchar())
    if (c == '-') f = -f;
  for (x = 0; c <= '9' && c >= '0'; c = getchar()) x = x * 10 + (c & 15);
  x *= f;
}
template <typename T>
inline void write(T x) {
  static char q[64];
  int cnt = 0;
  if (!x) putchar('0');
  if (x < 0) putchar('-'), x = -x;
  while (x) q[cnt++] = x % 10 + '0', x /= 10;
  while (cnt--) putchar(q[cnt]);
}
const int maxn = 50005;
const int Base = 29, mod = 1000000007;
int mo(const int x) { return x >= mod ? x - mod : x; }
char s[maxn];
int h[maxn], _Base[maxn];
int Get(int l, int r) {
  return mo(mod - 1ll * h[l - 1] * _Base[r - l + 1] % mod + h[r]);
}
int n;
int LCS(int x, int y) {
  int l = 0, r = min(x, y);
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    if (Get(x - mid + 1, x) == Get(y - mid + 1, y))
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int LCP(int x, int y) {
  int l = 0, r = n - max(x, y) + 1;
  while (l < r) {
    int mid = (l + r + 1) >> 1;
    if (Get(x, x + mid - 1) == Get(y, y + mid - 1))
      l = mid;
    else
      r = mid - 1;
  }
  return l;
}
int vis[maxn];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  _Base[0] = 1;
  for (int i = 1; i <= n; ++i) _Base[i] = 1ll * _Base[i - 1] * Base % mod;
  for (int i = 1; i <= n; ++i)
    h[i] = mo(1ll * h[i - 1] * Base % mod + (s[i] - 'a' + 1));
  for (int dis = 1; dis <= n; ++dis) {
    int ok = false, pos = 0;
    for (int j = dis, k = j + dis; k <= n; j += dis, k += dis) {
      int lcs = LCS(j, k), lcp = LCP(j, k);
      lcs = min(lcs, j - pos + 1);
      if (lcs + lcp > dis) {
        ok = true;
        ++vis[j - lcs + 1];
        --vis[j - lcs + dis + 1];
        pos = j - lcs + dis + 1;
      }
    }
    if (ok) {
      for (int i = 1; i <= n; ++i) vis[i] += vis[i - 1];
      int m = 0;
      for (int i = 1; i <= n; ++i) {
        if (!vis[i]) {
          s[++m] = s[i];
          h[m] = mo(1ll * h[m - 1] * Base % mod + (s[m] - 'a' + 1));
        }
        vis[i] = 0;
      }
      n = m;
      s[m + 1] = '\0';
    }
  }
  printf("%s\n", s + 1);
  return 0;
}