Problem: Given a string s, determine if it contains any palindrome of length exactly 100 as a subsequence. If it has any, print any one of them. If it doesn't have any, print a palindrome that is a subsequence of s and is as long as possible.

Input

The only line of the input contains one string s of length n (1 ≤ n ≤ 5·104) containing only lowercase English letters.

Output

If s contains a palindrome of length exactly 100 as a subsequence, print any palindrome of length 100 which is a subsequence of s. If s doesn't contain any palindromes of length exactly 100, print a palindrome that is a subsequence of s and is as long as possible.

If there exists multiple answers, you are allowed to print any of them.

Examples

Input

bbbabcbbb


Output

bbbcbbb


Input

rquwmzexectvnbanemsmdufrg


Output

rumenanemur

Note

A subsequence of a string is a string that can be derived from it by deleting some characters without changing the order of the remaining characters. A palindrome is a string that reads the same forward or backward.

Solution (in JAVA):

Solution:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Palindrome {

	static char[] s;
	static int[][] dp, p;

	static int solve(int i, int j) {
		if (i > j)
			return 0;
		if (i == j)
			return 1;
		if (dp[i][j] != -1)
			return dp[i][j];
		if (s[i] == s[j]) {
			p[i][j] = 1;
			return dp[i][j] = 2 + solve(i + 1, j - 1);
		}
		int x = solve(i + 1, j);
		int y = solve(i, j - 1);
		if (x > y) {
			p[i][j] = 2;
			return dp[i][j] = x;
		}
		p[i][j] = 3;
		return dp[i][j] = y;
	}

	public static void main(String[] args) throws IOException {
		br = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter out = new PrintWriter(System.out);
		sc = new StringTokenizer(br.readLine());
		s = nxtCharArr();
		if (s.length >= 2600) {
			int[] a = new int[26];
			for (int i = 0; i < s.length; i++)
				a[s[i] - 'a']++;
			for (int i = 0; i < a.length; i++)
				if (a[i] > 99) {
					for (int j = 0; j < 100; j++)
						out.print((char) (i + 'a'));
					break;
				}
			out.println();
		} else {
			dp = new int[s.length][s.length];
			p = new int[s.length][s.length];
			for (int i = 0; i < s.length; i++)
				Arrays.fill(dp[i], -1);
			solve(0, s.length - 1);
			int i = 0;
			int j = s.length - 1;
			boolean[] v = new boolean[s.length];
			int cnt = 0;
			while (i < j && cnt < 100) {
				if (p[i][j] == 1) {
					v[i++] = v[j--] = true;
					cnt += 2;
				} else if (p[i][j] == 2)
					i++;
				else if (p[i][j] == 3)
					j--;
			}
			if (i == j && cnt != 100)
				v[i] = true;
			for (int k = 0; k < v.length; k++)
				if (v[k])
					out.print(s[k]);
			out.println();
		}
		br.close();
		out.close();
	}

	static BufferedReader br;
	static StringTokenizer sc;

	static String nxtTok() throws IOException {
		while (!sc.hasMoreTokens()) {
			String s = br.readLine();
			if (s == null)
				return null;
			sc = new StringTokenizer(s.trim());
		}
		return sc.nextToken();
	}

	static int nxtInt() throws IOException {
		return Integer.parseInt(nxtTok());
	}

	static long nxtLng() throws IOException {
		return Long.parseLong(nxtTok());
	}

	static double nxtDbl() throws IOException {
		return Double.parseDouble(nxtTok());
	}

	static int[] nxtIntArr(int n) throws IOException {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtInt();
		return a;
	}

	static long[] nxtLngArr(int n) throws IOException {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nxtLng();
		return a;
	}

	static char[] nxtCharArr() throws IOException {
		return nxtTok().toCharArray();
	}
}