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 twx = 5e4 + 100;
const int CNM_SB_GRD_GUN = 13331;
const int inf = 0x3f3f3f3f;
char buf[1 << 20], *p1, *p2;
long long read() {
  long long sum = 0;
  long long flag = 1;
  char c =
      ((p1 == p2) && (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2)
           ? EOF
           : *p1++);
  while (c < '0' || c > '9') {
    if (c == '-') {
      flag = -1;
    }
    c = ((p1 == p2) &&
                 (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  while (c >= '0' && c <= '9') {
    sum = ((sum * 10) + c - '0');
    c = ((p1 == p2) &&
                 (p2 = (p1 = buf) + fread(buf, 1, 1 << 20, stdin), p1 == p2)
             ? EOF
             : *p1++);
  }
  return sum * flag;
}
int n;
char s[twx];
long long Hash[twx];
long long p[twx];
int SBZY[twx];
int qf = 0;
int qb = 0;
void hhash() {
  Hash[0] = 0;
  for (int i = 1; i <= n; i++) {
    Hash[i] = Hash[i - 1] * CNM_SB_GRD_GUN + s[i];
  }
}
bool mycmp(int x, int y, int z) {
  return Hash[x + z - 1] - Hash[y + z - 1] ==
         (Hash[x - 1] - Hash[y - 1]) * p[z];
}
int lcp(int x, int y) {
  int l = 1;
  int r = n - max(x, y) + 1;
  int m;
  while (l <= r) {
    m = l + r >> 1;
    if (mycmp(x, y, m)) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  return r;
}
int lcs(int x, int y) {
  int l = 1;
  int r = min(x, y);
  int m;
  while (l <= r) {
    m = l + r >> 1;
    if (mycmp(x - m + 1, y - m + 1, m)) {
      l = m + 1;
    } else {
      r = m - 1;
    }
  }
  return r;
}
void init() {
  scanf("%s", s + 1);
  n = strlen(s + 1);
  p[0] = 1;
  for (int i = 1; i <= n; i++) {
    p[i] = p[i - 1] * CNM_SB_GRD_GUN;
  }
}
void work() {
  hhash();
  for (int len = 1; len <= n / 2; len++) {
    int rig = 0;
    for (int i = 1, j = 1 + len; j <= n; i += len, j += len) {
      int l = lcs(i, j), r = lcp(i, j);
      if (i - l < rig) {
        l = i - rig;
      }
      if (l + r - 1 >= len) {
        SBZY[qb++] = i - l + 1;
        rig = SBZY[qb - 1] + len - 1;
      }
    }
    if (qb != qf) {
      int j = 0;
      for (int i = 1; i <= n; i++) {
        if (SBZY[qf] == i) {
          i += len - 1;
          qf++;
        } else {
          s[++j] = s[i];
        }
      }
      n = j;
      hhash();
    }
  }
  s[n + 1] = 0;
}
void print() { puts(s + 1); }
int main() {
  init();
  work();
  print();
  return 0;
}