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

Solution:
#include <bits/stdc++.h>
using namespace std;
char s[50010];
char pa[2610];
int dp[2610][2610][2], g, n;
void dfs(int ss, int i, int j, int k) {
  if (ss == 0) return;
  if (i == j) {
    pa[g++] = s[i];
    return;
  }
  if (i != n - 1 && j && s[i] == s[j] &&
      dp[i][j][k] == dp[i + 1][j - 1][k] + 2) {
    pa[g++] = s[i];
    dfs(dp[i + 1][j - 1][k], i + 1, j - 1, k);
    return;
  }
  if (i != n - 1 && dp[i][j][k] == dp[i + 1][j][k]) {
    dfs(dp[i + 1][j][k], i + 1, j, k);
    return;
  }
  if (j && dp[i][j][k] == dp[i][j - 1][k]) {
    dfs(dp[i][j - 1][k], i, j - 1, k);
    return;
  }
}
int main() {
  int i, j;
  cin >> s;
  int k = strlen(s);
  n = k;
  if (k >= 2600) {
    for (i = 1; i <= 100; i++) printf("a");
    puts("");
  } else {
    for (i = 0; i < k; i++) {
      dp[i][i][0] = 1;
    }
    for (i = k - 1; i >= 0; i--)
      for (j = i + 1; j < k; j++) {
        if (s[i] == s[j]) {
          dp[i][j][0] = dp[i + 1][j - 1][0] + 2;
          dp[i][j][1] = dp[i + 1][j - 1][1] + 2;
        }
        dp[i][j][0] = max(dp[i][j][0], max(dp[i + 1][j][0], dp[i][j - 1][0]));
        dp[i][j][1] = max(dp[i][j][1], max(dp[i + 1][j][1], dp[i][j - 1][1]));
      }
  }
  if (dp[0][k - 1][1] >= 100) {
    dfs(dp[0][k - 1][1], 0, k - 1, 1);
    for (i = 0; i < 50; i++) printf("%c", pa[i]);
    for (i = 50 - 1; i >= 0; i--) printf("%c", pa[i]);
    puts("");
  } else {
    dfs(dp[0][k - 1][0], 0, k - 1, 0);
    for (i = 0; i < g; i++) printf("%c", pa[i]);
    if (dp[0][k - 1][0] % 2 != 0) g--;
    for (i = g - 1; i >= 0; i--) printf("%c", pa[i]);
    puts("");
  }
  return 0;
}