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 main() {
  string s;
  cin >> s;
  vector<string> S(26);
  for (auto ch : s) {
    S[ch - 'a'] += ch;
    if (S[ch - 'a'].size() == 100) {
      cout << S[ch - 'a'] << endl;
      return 0;
    }
  }
  int n = s.size();
  int f[n + 1][n + 1];
  int g[n + 1][n + 1];
  for (int len = 1; len <= n; ++len)
    for (int i = 0; i + len - 1 < n; ++i) {
      if (len == 1)
        f[len][i] = 1;
      else if (len == 2 && s[i] == s[i + len - 1])
        f[len][i] = 2;
      else {
        int a = f[len - 1][i] < f[len - 1][i + 1] ? f[len - 1][i + 1]
                                                  : f[len - 1][i];
        if (f[len - 1][i] == a)
          g[len][i] = 0;
        else
          g[len][i] = 1;
        if (len > 2 && s[i] == s[i + len - 1] && 2 + f[len - 2][i + 1] > a) {
          a = 2 + f[len - 2][i + 1];
          g[len][i] = 2;
        }
        f[len][i] = a;
      }
    }
  vector<int> v;
  int len = n, x = 0;
  while (true) {
    if (len == 1) {
      v.push_back(x);
      break;
    }
    if (len == 2 && s[x] == s[x + len - 1]) {
      v.push_back(x);
      v.push_back(x + 1);
      break;
    }
    if (g[len][x] == 0)
      --len;
    else if (g[len][x] == 1) {
      --len;
      ++x;
    } else {
      v.push_back(x);
      v.push_back(x + len - 1);
      len -= 2;
      ++x;
    }
  }
  sort(v.begin(), v.end());
  int take = 50;
  for (int i = 0; i < v.size(); ++i)
    if (i < take || i + take >= v.size()) cout << s[v[i]];
  return 0;
}