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[110000];
int f[3100][3100];
int g[3100][3100];
int las[3100][31];
char ans[31000];
int tot = 0;
void calc(int x, int y) {
  if (f[x][y] == 0) return;
  if (g[x][y] == 3) {
    if (x != y) ans[++tot] = s[x];
    calc(x - 1, y + 1);
    ans[++tot] = s[y];
  }
  if (g[x][y] == 2) {
    calc(x, y + 1);
  }
  if (g[x][y] == 1) {
    calc(x - 1, y);
  }
}
int sum[110];
int main() {
  scanf("%s", s + 1);
  int n = strlen(s + 1);
  memset(las, 0, sizeof(las));
  if (n >= 2600) {
    for (int i = 1; i <= n; i++) sum[s[i] - 'a']++;
    for (int i = 0; i < 26; i++) {
      if (sum[i] >= 100) {
        for (int k = 1; k <= 100; k++) printf("%c", i + 'a');
        printf("\n");
        break;
      }
    }
  } else {
    memset(f, 0, sizeof(f));
    for (int i = 1; i <= n; i++)
      for (int j = n; j >= i; j--) {
        if (f[i - 1][j] > f[i][j]) {
          f[i][j] = f[i - 1][j];
          g[i][j] = 1;
        }
        if (f[i][j + 1] > f[i][j]) {
          f[i][j] = f[i][j + 1];
          g[i][j] = 2;
        }
        if (i != j && s[i] == s[j] && f[i - 1][j + 1] + 1 > f[i][j]) {
          f[i][j] = f[i - 1][j + 1] + 2;
          g[i][j] = 3;
        }
        if (i == j && s[i] == s[j] && f[i - 1][j + 1] + 1 > f[i][j]) {
          f[i][j] = f[i - 1][j + 1] + 1;
          g[i][j] = 3;
        }
      }
    int len = -1;
    int x, y;
    for (int i = 1; i <= n; i++)
      for (int j = i; j <= n; j++) {
        if (f[i][j] <= 100 && f[i][j] > len) {
          len = f[i][j];
          x = i, y = j;
        }
      }
    calc(x, y);
    len = tot / 2;
    for (int i = len; i >= 1; i--) printf("%c", ans[i]);
    if (tot % 2 == 1) printf("%c", ans[tot]);
    for (int i = 1; i <= len; i++) printf("%c", ans[i]);
    printf("\n");
  }
}