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;
char s[100010];
int n, sa[100010], rnk[100010], hei[100010], st[100010][22], LOG[100010],
    del[100010];
template <typename T>
void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
void suffix(int n) {
  static int x[100010], y[100010], rk[100010], cnt[100010];
  memset(cnt, 0, sizeof(cnt));
  for (int i = 1; i <= n; ++i) ++cnt[s[i] - 'a'];
  for (int i = 1; i <= 26; ++i) cnt[i] += cnt[i - 1];
  for (int i = n; i >= 1; --i) sa[cnt[s[i] - 'a']--] = i;
  rnk[sa[1]] = 1;
  for (int i = 2; i <= n; ++i)
    rnk[sa[i]] = rnk[sa[i - 1]] + (s[sa[i]] != s[sa[i - 1]]);
  for (int len = 1; rnk[sa[n]] != n; len <<= 1) {
    for (int i = 1; i <= n; ++i)
      x[i] = rnk[i], y[i] = (i + len <= n) ? rnk[i + len] : 0;
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; ++i) ++cnt[y[i]];
    for (int i = 1; i <= n; ++i) cnt[i] += cnt[i - 1];
    for (int i = n; i >= 1; --i) rk[cnt[y[i]]--] = i;
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; ++i) ++cnt[x[i]];
    for (int i = 1; i <= n; ++i) cnt[i] += cnt[i - 1];
    for (int i = n; i >= 1; --i) sa[cnt[x[rk[i]]]--] = rk[i];
    rnk[sa[1]] = 1;
    for (int i = 2; i <= n; ++i)
      rnk[sa[i]] = rnk[sa[i - 1]] +
                   (x[sa[i]] != x[sa[i - 1]] || y[sa[i]] != y[sa[i - 1]]);
  }
}
void gethei(int n) {
  int cur = 0;
  for (int i = 1; i <= n; ++i) {
    if (cur) --cur;
    for (int j = sa[rnk[i] + 1]; s[i + cur] == s[j + cur]; ++cur)
      ;
    hei[rnk[i]] = cur;
  }
}
void getrmq(int n) {
  for (int i = 1; i <= n; ++i) st[i][0] = hei[i];
  for (int len = 1; len < 22; ++len)
    for (int i = 1; i + (1 << len) - 1 <= n; ++i)
      st[i][len] = min(st[i][len - 1], st[i + (1 << (len - 1))][len - 1]);
}
int rmq(int l, int r) {
  int len = LOG[r - l + 1];
  return min(st[l][len], st[r - (1 << len) + 1][len]);
}
int lcs(int l, int r) {
  l = rnk[2 * n - l + 2], r = rnk[2 * n - r + 2];
  if (l > r) swap(l, r);
  --r;
  return rmq(l, r);
}
int lcp(int l, int r) {
  l = rnk[l], r = rnk[r];
  if (l > r) swap(l, r);
  --r;
  return rmq(l, r);
}
void init(int n) {
  s[n + 1] = (char)'z' + 1;
  for (int i = 1; i <= n; ++i) s[n + i + 1] = s[n - i + 1];
  memset(sa, 0, sizeof(sa));
  suffix(2 * n + 1);
  gethei(2 * n + 1);
  getrmq(2 * n + 1);
}
int main() {
  LOG[1] = 0;
  for (int i = 2; i < 100010; ++i)
    LOG[i] = LOG[i - 1] + ((1 << (LOG[i - 1] + 1)) == i);
  scanf("%s", s + 1);
  n = strlen(s + 1);
  init(n);
  for (int len = 1; len <= n / 2; ++len) {
    int fla = 0;
    for (int i = 1, j = i + 1; j * len <= n; ++i, ++j) {
      int L = min(lcs(i * len, j * len), len),
          R = min(lcp(i * len, j * len), len);
      while (del[i * len - L + 1]) --L;
      if (L + R - 1 >= len) {
        fla = 1;
        for (int t = i * len - L + 1; t < j * len - L + 1; ++t) del[t] = 1;
      }
    }
    if (fla) {
      int len = 0;
      for (int i = 1; i <= n; ++i)
        if (!del[i]) s[++len] = s[i];
      n = len;
      memset(del, 0, sizeof(del));
      init(n);
    }
  }
  for (int i = 1; i <= n; ++i) putchar(s[i]);
  puts("");
  return 0;
}