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 s;
int n, a[50005], f[50005][102], pos[50005][102], ans = 1, vt = 1;
bool dd[50005];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> s;
  n = s.size();
  for (int i = 0; i < n; ++i) a[i + 1] = s[i] - 'a';
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j < 26; ++j) {
      if (a[i] == j)
        pos[i][j] = i;
      else
        pos[i][j] = pos[i - 1][j];
    }
  }
  for (int i = 1; i <= n; ++i) f[i][1] = i, f[i][0] = i + 1;
  for (int i = 2; i <= n; ++i) {
    for (int j = 2; j <= min(100, i); ++j) {
      if (f[i - 1][j] != 0) f[i][j] = f[i - 1][j];
      if (f[i - 1][j - 2] != 0) {
        f[i][j] = max(pos[f[i - 1][j - 2] - 1][a[i]], f[i][j]);
      }
      if (f[i][j] > 0 && j > ans) {
        ans = j;
        vt = i;
      }
    }
  }
  while (ans > 1) {
    if (f[vt - 1][ans - 2] > 0)
      if (f[vt][ans] == pos[f[vt - 1][ans - 2] - 1][a[vt]]) {
        dd[vt] = 1;
        dd[f[vt][ans]] = 1;
        vt = vt - 1;
        ans = ans - 2;
      } else {
        vt = vt - 1;
      }
  }
  if (ans == 1) dd[vt] = 1;
  for (int i = 1; i <= n; ++i) {
    if (dd[i]) cout << s[i - 1];
  }
  return 0;
}