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;
string S;
int s;
int num[50005], tmp[50005];
long long hsh[50005], hsh2[50005];
long long power[50005], power2[50005];
vector<pair<int, int> > op;
void recalculate(int s) {
  for (int j = (0); j <= (s - 1); j += (1)) {
    if (j == 0) {
      hsh[j] = hsh2[j] = S[num[j]] - 'a';
    } else {
      hsh[j] = (hsh[j - 1] * 99991 + S[num[j]] - 'a') % 805306457;
      hsh2[j] = (hsh2[j - 1] * 99991 + S[num[j]] - 'a') % 1610612741;
    }
  }
}
bool cmp(int i, int j, int d) {
  d = (1 << d);
  long long vi =
      (hsh[i + d - 1] - hsh[i - 1] * power[d] % 805306457 + 805306457) %
      805306457;
  long long vi2 =
      (hsh2[i + d - 1] - hsh2[i - 1] * power2[d] % 1610612741 + 1610612741) %
      1610612741;
  long long vj =
      (hsh[j + d - 1] - hsh[j - 1] * power[d] % 805306457 + 805306457) %
      805306457;
  long long vj2 =
      (hsh2[j + d - 1] - hsh2[j - 1] * power2[d] % 1610612741 + 1610612741) %
      1610612741;
  return (vi == vj && vi2 == vj2);
}
int findlcp(int i, int j) {
  if (i < 0 || j >= s) return 0;
  int ans = 0;
  for (int k = (15); k >= (0); k -= (1)) {
    if (j + (1 << k) > s) continue;
    if (cmp(i, j, k)) {
      i += (1 << k);
      j += (1 << k);
      ans += (1 << k);
    }
  }
  return ans;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> S;
  s = S.length();
  for (int i = (0); i <= (s - 1); i += (1)) {
    num[i] = i;
    if (i == 0)
      power[i] = power2[i] = 1;
    else {
      power[i] = power[i - 1] * 99991 % 805306457;
      power2[i] = power2[i - 1] * 99991 % 1610612741;
    }
  }
  recalculate(s);
  for (int i = (1); i <= (s / 2); i += (1)) {
    op.clear();
    for (int j = (i); j <= (s - 1); j += (i)) {
      int pj = j - i;
      int lcp = findlcp(pj, j);
      int minus = (i - lcp % i) % i;
      int lcp2 = findlcp(pj - minus, j - minus);
      if (lcp2 >= i) {
        op.push_back({pj - minus, -1});
        op.push_back({j - minus, 1});
      }
    }
    if (op.empty()) continue;
    int ops = op.size();
    int d = 0, pd = 0, cnt = 0, it = -1;
    for (int j = (0); j <= (ops - 1); j += (1)) {
      pair<int, int> a = op[j];
      while (j < ops - 1 && a.first == op[j + 1].first)
        a.second += op[++j].second;
      d += a.second;
      if (pd == 0)
        while (cnt < a.first) tmp[++it] = num[cnt], cnt++;
      if (d == 0) cnt = a.first;
      pd = d;
    }
    if (pd == 0)
      while (cnt <= s - 1) tmp[++it] = num[cnt], cnt++;
    s = it + 1;
    for (int j = (0); j <= (s - 1); j += (1)) num[j] = tmp[j];
    recalculate(s);
  }
  for (int i = (0); i <= (s - 1); i += (1)) {
    printf("%c", S[num[i]]);
  }
  printf("\n");
  return 0;
}