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[50003];
int n, a[256];
string p, res;
int f[2602][2602];
int getmax(int a, int b) {
  if (a > b) return a;
  return b;
}
void truy(int i, int j) {
  if (i == j) res.push_back(s[i]);
  if (i >= j) return;
  if (f[i][j] == 0) return;
  if ((s[i] == s[j]) && (f[i][j] == (f[i + 1][j - 1] + 2))) {
    res.push_back(s[i]);
    truy(i + 1, j - 1);
    res.push_back(s[j]);
    return;
  } else {
    if (f[i][j] == f[i + 1][j]) {
      truy(i + 1, j);
      return;
    } else {
      truy(i, j - 1);
      return;
    }
  }
}
void dppalind() {
  int i, j, k;
  p.clear();
  memset(f, 0, sizeof(f));
  for (i = 0; i < n; i++) {
    f[i][i] = 1;
  }
  for (i = 0; (i + 1) < n; i++) {
    if (s[i] == s[i + 1])
      f[i][i + 1] = 2;
    else
      f[i][i + 1] = 1;
  }
  for (k = 2; k < n; k++) {
    for (i = 0; i < n; i++) {
      j = i + k;
      if (j >= n) break;
      if (s[i] == s[j])
        f[i][j] = getmax(f[i + 1][j - 1] + 2, getmax(f[i + 1][j], f[i][j - 1]));
      else
        f[i][j] = getmax(f[i + 1][j], f[i][j - 1]);
    }
  }
}
int main() {
  gets(s);
  n = strlen(s);
  int i, j, k;
  memset(a, 0, sizeof(a));
  for (i = 0; i < n; i++) {
    a[s[i]]++;
    if (a[s[i]] >= 100) {
      for (j = 0; j < 100; j++) printf("%c", s[i]);
      return 0;
    }
  }
  dppalind();
  res.clear();
  truy(0, n - 1);
  n = res.length();
  if (n <= 100) {
    cout << res;
    return 0;
  }
  int c;
  res = res.substr(0, 50);
  for (i = 49; i >= 0; i--) res.push_back(res[i]);
  cout << res;
  return 0;
}