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;
const int maxn = 50010;
class SA {
 public:
  int lg2[maxn], st[maxn][16], x[maxn], y[maxn], sa[maxn], c[maxn],
      height[maxn], rk[maxn];
  void getsa(char *s, int n) {
    int m = 150;
    memset(c, 0, sizeof(c));
    memset(sa, 0, sizeof(sa));
    memset(height, 0, sizeof(height));
    memset(rk, 0, sizeof(rk));
    memset(x, 0, sizeof(x));
    memset(y, 0, sizeof(y));
    for (int i = 1; i <= n; i++) ++c[x[i] = s[i]];
    for (int i = 2; i <= m; i++) c[i] += c[i - 1];
    for (int i = n; i >= 1; i--) sa[c[x[i]]--] = i;
    for (int k = 1; k <= n; k <<= 1) {
      int num = 0;
      for (int i = n - k + 1; i <= n; i++) y[++num] = i;
      for (int i = 1; i <= n; i++)
        if (sa[i] > k) y[++num] = sa[i] - k;
      fill(c, c + m + 1, 0);
      for (int i = 1; i <= n; i++) ++c[x[i]];
      for (int i = 2; i <= m; i++) c[i] += c[i - 1];
      for (int i = n; i >= 1; i--) sa[c[x[y[i]]]--] = y[i], y[i] = 0;
      swap(x, y);
      x[sa[1]] = 1;
      num = 1;
      for (int i = 2; i <= n; i++) {
        x[sa[i]] =
            (y[sa[i]] == y[sa[i - 1]] && y[sa[i] + k] == y[sa[i - 1] + k])
                ? num
                : ++num;
      }
      if (num == n) break;
      m = num;
    }
  }
  void getheight(char *s, int n) {
    int k = 0;
    for (int i = 1; i <= n; i++) rk[sa[i]] = i;
    for (int i = 1; i <= n; i++) {
      if (rk[i] == 1) continue;
      if (k) k--;
      int j = sa[rk[i] - 1];
      while (j + k <= n && i + k <= n && s[j + k] == s[i + k]) k++;
      height[rk[i]] = k;
    }
  }
  void getst(int n) {
    memset(st, 0x3f, sizeof(st));
    lg2[1] = 0;
    for (int i = 2; i <= n; i++) lg2[i] = lg2[i >> 1] + 1;
    for (int i = 1; i <= n; i++) st[i][0] = height[i];
    for (int j = 1; j < 16; j++) {
      for (int i = 1; i + (1 << j) - 1 <= n; i++) {
        st[i][j] = min(st[i][j - 1], st[i + (1 << (j - 1))][j - 1]);
      }
    }
  }
  inline int lcp(int l, int r) {
    l = rk[l], r = rk[r];
    if (l > r) swap(l, r);
    l++;
    int lp = lg2[r - l + 1];
    return min(st[l][lp], st[r - (1 << lp) + 1][lp]);
  }
} sa[2];
char s[maxn], buf[maxn];
int n;
bool flag[maxn];
int main() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  while (1) {
    memset(flag, 0, sizeof(flag));
    sa[0].getsa(s, n);
    sa[0].getheight(s, n);
    sa[0].getst(n);
    reverse(s + 1, s + n + 1);
    sa[1].getsa(s, n);
    sa[1].getheight(s, n);
    sa[1].getst(n);
    reverse(s + 1, s + n + 1);
    bool f = 1;
    for (int len = 1; len <= (n >> 1); len++) {
      int lst = 0;
      for (int i = len; i + len <= n; i += len) {
        int l1 = sa[0].lcp(i, i + len),
            l2 = sa[1].lcp(n + 2 - i, n + 2 - i - len);
        l1 = min(l1, len);
        l2 = min(l2, len);
        if (l1 + l2 >= len) {
          int s = i - l2, e = i + l1 - len;
          if (e > lst) {
            int pos = max(s, lst + 1);
            lst = pos + len - 1;
            flag[pos] = 1;
          }
        }
      }
      if (lst) {
        f = 0;
        int tmp = 0;
        for (int i = 1; i <= n; i++) {
          while (i <= n && flag[i]) i += len;
          buf[++tmp] = s[i];
        }
        fill(s + 1, s + n + 1, 0);
        n = tmp;
        copy(buf + 1, buf + n + 1, s + 1);
        break;
      }
    }
    if (f) break;
  }
  puts(s + 1);
  return 0;
}