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;
const int N = 2600;
int dem[30], f[N][N];
pair<int, int> step[N][N];
string a, b, ans;
void truyvet(pair<int, int> x) {
  if (x.first == 0 || x.second == 0) return;
  if (a[x.first] == b[x.second]) ans += a[x.first];
  truyvet(step[x.first][x.second]);
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> a;
  int n = a.length();
  for (int i = 0; i < n; ++i) {
    dem[a[i] - 'a']++;
    if (dem[a[i] - 'a'] >= 100) {
      for (int j = 0; j < 100; ++j) cout << a[i];
      return 0;
    }
  }
  b = a;
  b = ' ' + b;
  reverse(a.begin(), a.end());
  a = ' ' + a;
  int ok = 1, check = 1;
  int pos1 = n, pos2 = n;
  for (int i = 1; i <= n && check; ++i)
    for (int j = 1; j <= n && check; ++j) {
      if (a[i] == b[j]) {
        f[i][j] = f[i - 1][j - 1] + 1;
        step[i][j] = pair<int, int>(i - 1, j - 1);
      } else {
        if (f[i - 1][j] < f[i][j - 1]) {
          f[i][j] = f[i][j - 1];
          step[i][j] = pair<int, int>(i, j - 1);
        } else {
          f[i][j] = f[i - 1][j];
          step[i][j] = pair<int, int>(i - 1, j);
        }
      }
    }
  truyvet(pair<int, int>(pos1, pos2));
  if (ans.size() > 100) {
    n = ans.size();
    if (n % 2) {
      ans.erase(ans.begin() + (ans.size() / 2));
      while (ans.size() > 100) {
        ans.erase(ans.begin());
        ans.pop_back();
      }
    } else {
      while (ans.size() > 100) {
        ans.erase(ans.begin());
        ans.pop_back();
      }
    }
  }
  cout << ans;
}