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;
int n;
int SA[100005], SA2[100005], R[100005], R2[100005], h[100005], cnt[300],
    T[100005][18], lg[100005];
char s[100005], S[100005], buf[100005];
void build(int n, char s[], int R[], int SA[], int h[]) {
  memset(cnt, 0, sizeof(cnt));
  for (int i = 0; i < n; i++) cnt[s[i]]++;
  for (int i = 1; i < 256; i++) cnt[i] += cnt[i - 1];
  for (int i = 0; i < n; i++) SA[--cnt[s[i]]] = i;
  R[SA[0]] = 0;
  R[n] = -1;
  for (int i = 1; i < n; i++)
    R[SA[i]] = R[SA[i - 1]] + (s[SA[i]] != s[SA[i - 1]]);
  for (int k = 1; k <= n; k <<= 1) {
    for (int i = 0; i < n; i++) cnt[R[SA[i]]] = i + 1;
    for (int i = n - 1; i >= 0; i--)
      if (SA[i] >= k) SA2[--cnt[R[SA[i] - k]]] = SA[i] - k;
    for (int i = n - k; i < n; i++) SA2[--cnt[R[i]]] = i;
    R2[SA2[0]] = 0;
    for (int i = 1; i < n; i++)
      R2[SA2[i]] = R2[SA2[i - 1]] + (R[SA2[i]] != R[SA2[i - 1]] ||
                                     R[SA2[i] + k] != R[SA2[i - 1] + k]);
    for (int i = 0; i < n; i++) R[i] = R2[i], SA[i] = SA2[i];
  }
  for (int i = 0, x = 0; i < n; i++) {
    if (R[i] == n - 1)
      h[R[i]] = x = 0;
    else {
      if (x > 0) x--;
      int y = SA[R[i] + 1];
      while (i + x < n && y + x < n && s[i + x] == s[y + x]) x++;
      h[R[i]] = x;
    }
  }
}
void buildST(int n, int a[]) {
  for (int i = 0; i < n; i++) T[i][0] = a[i];
  for (int j = 1; (1 << j) <= n; j++)
    for (int i = 0; i + (1 << j) - 1 < n; i++)
      T[i][j] = min(T[i][j - 1], T[i + (1 << (j - 1))][j - 1]);
}
int RMQ(int x, int y) {
  x = R[x], y = R[y];
  if (x > y) swap(x, y);
  y = y - 1;
  int t = lg[y - x + 1];
  return min(T[x][t], T[y - (1 << t) + 1][t]);
}
void build(int n, char s[]) {
  for (int i = (0); i < (n); i++) S[i] = S[n + n - i] = s[i];
  S[n] = '#', S[n + n + 1] = 0;
  build(n + n + 1, S, R, SA, h);
  buildST(n + n, h);
}
int cutLen(int n, char s[], int d) {
  int l = 0, t = 0;
  for (int i = 0; i < n; i++) {
    buf[l++] = s[i];
    if (l - d > 0 && buf[l - 1] == buf[l - d - 1])
      ++t;
    else
      t = 0;
    if (t == d) l -= d, t = 0;
  }
  buf[l] = 0;
  strcpy(s, buf);
  return l;
}
int hasRepeat(int n, int d) {
  int l, r;
  for (int i = d - 1; i + d < n; i += d) {
    l = RMQ(n + n - i, n + n - i - d);
    r = RMQ(i, i + d);
    if (l + r > d) return 1;
  }
  return 0;
}
int main() {
  scanf("%s", s);
  n = strlen(s);
  lg[0] = lg[1] = 0;
  for (int i = 2; i <= n + n; i++) lg[i] = lg[i >> 1] + 1;
  build(n, s);
  for (int i = 1; i + i <= n; i++) {
    if (hasRepeat(n, i)) {
      n = cutLen(n, s, i);
      build(n, s);
    }
  }
  printf("%s\n", s);
  return 0;
}