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 JAVA):

Solution:
import java.io.*;
import java.util.*;

public class D_new {

	BufferedReader br;
	PrintWriter out;
	StringTokenizer st;
	boolean eof;

	static final int FAST_THRESHOLD = 3;
	static final int INF = Integer.MAX_VALUE / 2;

	static int shortestTandem(String s) {
		String rev = new StringBuilder(s).reverse().toString();
		return shortestTandem(s, rev);
	}

	static int shortestTandem(String s, String rev) {

		if (s.length() < FAST_THRESHOLD) {
			for (int len = 1; len * 2 <= s.length(); len++) {
				for (int i = len; i <= s.length() - len; i++) {
					if (s.substring(i - len, i).equals(s.substring(i, i + len))) {
						return len;
					}
				}
			}
			return INF;
		}
		int n = s.length();
		int lenL = n / 2;
		int lenR = n - lenL;
		String left = s.substring(0, lenL);
		String right = s.substring(lenL);
		String leftRev = rev.substring(lenR);
		String rightRev = rev.substring(0, lenR);

		int ret = Math.min(shortestTandem(left, leftRev),
				shortestTandem(right, rightRev));

		int[] z1 = zFunc(right + left);
		int[] z2 = zFunc(leftRev + rightRev);
		// left
		for (int len = 1; len < ret && len <= lenL; len++) {
			int forw = Math.min(len, z1[n - len]);
			int back = Math.min(z2[len], Math.min(lenL - len, len));

			if (forw > 0 && forw + back >= len) {
				ret = len;
				break;
			}
		}

		// right
		for (int len = 1; len < ret && len <= lenR; len++) {
			int forw = Math.min(z1[len], Math.min(len, lenR - len));
			int back = Math.min(len, z2[n - len]);
			if (back > 0 && forw + back >= len) {
				ret = len;
				break;
			}
		}

		return ret;
	}

	static int[] zFunc(String s) {
		int n = s.length();
		int[] z = new int[n];
		for (int i = 1, l = 0, r = 0; i < n; i++) {
			int val = i < r ? Math.min(r - i, z[i - l]) : 0;
			while (i + val < n && s.charAt(val) == s.charAt(i + val))
				val++;
			if (i + val > r) {
				l = i;
				r = i + val;
			}
			z[i] = val;
		}
		return z;
	}

	static String solve(String s) {
		while (true) {
			int len = shortestTandem(s);
//			System.err.println(s + " " + len);
			if (len == INF) {
				break;
			}
			StringBuilder sb = new StringBuilder();
			int same = 0;
			for (int i = 0; i < s.length(); i++) {
				sb.append(s.charAt(i));
				if (sb.length() > len
						&& sb.charAt(sb.length() - 1) == sb.charAt(sb.length()
								- len - 1))
					same++;
				else
					same = 0;
				if (same == len) {
					sb.setLength(sb.length() - len);
					same = 0;
				}
			}
			s = sb.toString();
		}
		return s;
	}

	void solve() throws IOException {
		String s = br.readLine();
		out.println(solve(s));
	}

	D_new() throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		out = new PrintWriter(System.out);

		out.println(solve(br.readLine()));

		out.close();
	}

	public static void main(String[] args) throws IOException {
		new D_new();
	}

	String nextToken() {
		while (st == null || !st.hasMoreTokens()) {
			try {
				st = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				eof = true;
				return null;
			}
		}
		return st.nextToken();
	}

	String nextString() {
		try {
			return br.readLine();
		} catch (IOException e) {
			eof = true;
			return null;
		}
	}

	int nextInt() throws IOException {
		return Integer.parseInt(nextToken());
	}

	long nextLong() throws IOException {
		return Long.parseLong(nextToken());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(nextToken());
	}
}