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 x, res;
string dp[2610][2610];
int n;
string rec(int l, int r) {
  string &res = dp[l][r];
  if (res == "") {
    if (l == r)
      res = x[l];
    else if (l > r)
      res = "";
    else {
      if (x[l] == x[r])
        res = x[l] + rec(l + 1, r - 1) + x[r];
      else {
        res = rec(l + 1, r);
        if (rec(l, r - 1).size() > res.size()) res = rec(l, r - 1);
        if (rec(l + 1, r - 1).size() > res.size()) res = rec(l + 1, r - 1);
      }
    }
  }
  return res;
}
int main() {
  cin >> x;
  n = x.size();
  if (n > 2600) {
    vector<pair<int, int> > l(26);
    for (int i = 0; i < 26; ++i) l[i].second = i;
    for (int i = 0; i < n; ++i) l[x[i] - 'a'].first++;
    sort(l.begin(), l.end());
    char ch = 'a' + l[25].second;
    for (int i = 0; i < 100; ++i) res += ch;
  } else {
    res = rec(0, n - 1);
    if (res.size() > 100) {
      string res1;
      int w = res.size() / 2, g = 0;
      if (res.size() % 2) g = 1;
      for (int i = 0; i < 50; ++i) {
        res1 += res[w + i + g];
        res1 = res[w - i - 1] + res1;
      }
      res = res1;
    }
  }
  cout << res << endl;
  return 0;
}