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;
string lcs(string &X, string &Y) {
  int m = X.length();
  int n = Y.length();
  int L[m + 1][n + 1];
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= n; j++) {
      if (i == 0 || j == 0)
        L[i][j] = 0;
      else if (X[i - 1] == Y[j - 1])
        L[i][j] = L[i - 1][j - 1] + 1;
      else
        L[i][j] = max(L[i - 1][j], L[i][j - 1]);
    }
  }
  int index = L[m][n];
  string lcs(index, '\0');
  int i = m, j = n;
  while (i > 0 && j > 0) {
    if (X[i - 1] == Y[j - 1]) {
      lcs[index - 1] = X[i - 1];
      i--;
      j--;
      index--;
    } else if (L[i - 1][j] > L[i][j - 1])
      i--;
    else
      j--;
  }
  return lcs;
}
string longestPalSubseq(string &str) {
  string rev = str;
  reverse(rev.begin(), rev.end());
  return lcs(str, rev);
}
string s;
int main() {
  cin >> s;
  if (s.length() >= 2600) {
    for (char i = 'a'; i < 'z'; i++) {
      int cnt = 0;
      for (int j = 0; j < s.length(); j++) {
        if (s[j] == i) cnt++;
      }
      if (cnt >= 100) {
        for (int j = 0; j < 100; j++) {
          cout << i;
        }
        break;
      }
    }
  } else {
    string res = longestPalSubseq(s);
    int n = res.length();
    if (n > 100) {
      if (n % 2 != 0) {
        res.erase(res.begin() + n / 2);
      }
      int lef = (n - 100) / 2;
      res = res.substr(lef, 100);
    }
    cout << res;
  }
  return 0;
}