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;
long long f[2610][2610];
char res[3000];
string s;
long long cnt[30];
int main() {
  cin >> s;
  long long n = s.size(), mx = 0;
  char mxi;
  for (long long i = 0; i < n; i++) {
    ++cnt[s[i] - 'a'];
    if (mx < cnt[s[i] - 'a']) {
      mx = cnt[s[i] - 'a'];
      mxi = s[i];
    }
  }
  if (mx >= 100) {
    for (long long i = 0; i < 100; i++) cout << mxi;
    cout << endl;
    return 0;
  }
  for (int i = 0; i < n + 1; i++)
    for (int j = 0; j < n + 1; j++) f[i][j] = 0;
  for (int i = 0; i < n; i++) f[i][i] = 1;
  for (int m = 1; m < n; m++)
    for (int i = 0; i < n - m; i++) {
      int j = i + m;
      if (s[i] == s[j]) f[i][j] = f[i + 1][j - 1] + 2;
      if (f[i][j] < f[i + 1][j]) f[i][j] = f[i + 1][j];
      if (f[i][j] < f[i][j - 1]) f[i][j] = f[i][j - 1];
    }
  int i = 0;
  int j = n - 1;
  int len = f[i][j];
  res[len] = '\0';
  int a = 0;
  int b = f[i][j] - 1;
  while (i <= j) {
    if (i == j) {
      res[a] = s[i];
      break;
    }
    if (s[i] == s[j]) {
      res[a] = res[b] = s[i];
      a++, b--, i++, j--;
      continue;
    }
    if (f[i][j] == f[i + 1][j]) {
      i++;
      continue;
    }
    j--;
  }
  if (len > 100) {
    len = 100;
    for (int i = 0; i < 50; i++) res[99 - i] = res[i];
    res[len] = '\0';
  }
  cout << res << endl;
  return 0;
}