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 N = 1e5 + 5;
long long X1 = 277, X2 = 227;
long long M1 = 1777777777, M2 = 1444444447;
long long h1[N], h2[N];
long long p1[N], p2[N];
long long gh(int i, int j) {
  long long g1 = h1[j] - (i ? h1[i - 1] * p1[j - i + 1] : 0);
  g1 = (g1 % M1 + M1) % M1;
  long long g2 = h2[j] - (i ? h2[i - 1] * p2[j - i + 1] : 0);
  g2 = (g2 % M2 + M2) % M2;
  return g1 << 32 | g2;
}
void zf(char *s, int n, int *z) {
  for (int i = 1, j = z[0] = 0; i < n; ++i) {
    z[i] = max(0, min(z[i - j], j + z[j] - i));
    while (i + z[i] < n && s[z[i]] == s[z[i] + i]) ++z[i];
    if (j + z[j] < i + z[i]) j = i;
  }
  z[n] = 0;
}
int z1[N], z2[N];
char s1[N], s2[N];
int inf = 1e9;
int dup(char *s, int n) {
  int ans = inf;
  if (n == 2 && s[0] == s[1]) ans = 1;
  if (n < 3) return ans;
  int n1 = n >> 1;
  int n2 = n - n1;
  char *a = s, *b = s + n1;
  ans = min(ans, dup(a, n1));
  ans = min(ans, dup(b, n2));
  strncpy(s1, b, n2);
  s1[n2] = '$';
  strncpy(s1 + n2 + 1, a, n1);
  s1[n + 1] = 0;
  zf(s1, n + 1, z1);
  reverse(s1, s1 + n + 1);
  zf(s1, n + 1, z2);
  for (int i = 0; i <= n + 1; ++i)
    if (i < n1) {
      int l = z2[n1 - i];
      int r = z1[i + 1 + n2];
      if (l + r >= n1 - i) ans = min(ans, n1 - i);
    } else if (i > n1 + 1) {
      int l = z1[i - n1];
      int r = z2[n2 - (i - n1 - 1) - 1 + n1 + 1];
      if (l + r >= i - n1) ans = min(ans, i - n1);
    }
  return ans;
}
char s[N], t[N];
int main() {
  for (int i = p1[0] = 1; i < N; ++i) p1[i] = p1[i - 1] * X1 % M1;
  for (int i = p2[0] = 1; i < N; ++i) p2[i] = p2[i - 1] * X2 % M2;
  gets(s);
  int pre = 0;
  for (;;) {
    int n = strlen(s);
    for (int i = 0; i < n; ++i) h1[i] = ((i ? h1[i - 1] * X1 : 0) + s[i]) % M1;
    for (int i = 0; i < n; ++i) h2[i] = ((i ? h2[i - 1] * X2 : 0) + s[i]) % M2;
    int len = dup(s, n);
    if (len >= n) break;
    int m = 0;
    for (int i = 0; i < n; ++i) {
      t[m] = s[i];
      h1[m] = ((m ? h1[m - 1] : 0) * X1 + t[m]) % M1;
      h2[m] = ((m ? h2[m - 1] : 0) * X2 + t[m]) % M2;
      ++m;
      if (i >= len * 2 - 1) {
        long long v1 = gh(m - len, m - 1);
        long long v2 = gh(m - len * 2, m - len - 1);
        if (v1 == v2) m -= len;
      }
    }
    t[m] = 0;
    strcpy(s, t);
  }
  cout << s << endl;
  return 0;
}