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;
int dp[2610][2610];
int us[2610][2610];
string s;
int len;
int d_p(int i, int j) {
  if (us[i][j]) return dp[i][j];
  us[i][j] = 1;
  if (i > j) return 0;
  if (i == j) return dp[i][j] = 1;
  return dp[i][j] = max(d_p(i + 1, j - 1) + 2 * (s[i] == s[j]),
                        max(d_p(i + 1, j), d_p(i, j - 1)));
}
string ans(int i, int j) {
  char res[2700];
  res[len] = '\0';
  int a = 0;
  int b = len - 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 (dp[i][j] == dp[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';
  }
  string an = res;
  return an;
}
int main() {
  cin >> s;
  if (s.size() >= 2600) {
    vector<int> a(100, 0);
    for (int i = 0; i < s.size(); i++) a[s[i] - 'a']++;
    for (int i = 0; i < 100; i++)
      if (a[i] >= 100) {
        for (int j = 0; j < 100; j++) cout << char(i + 'a');
        cout << endl;
        return 0;
      }
  } else {
    len = d_p(0, s.size() - 1);
    cout << ans(0, s.size() - 1) << endl;
  }
  return 0;
}