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 maxn = 2601;
int cnt[300], dp[maxn][maxn];
pair<int, int> l[maxn][maxn];
string s;
int solve(int i, int j) {
  int &res = dp[i][j];
  if (res > 0) return res;
  if (i + 1 >= j) {
    if (i == j) {
      res = 1;
      l[i][j] = make_pair(i, j);
      return res;
    }
    if (s[i] == s[j]) {
      res = 2;
      l[i][j] = make_pair(i, j);
    } else {
      res = 1;
      l[i][j] = make_pair(i, i);
    }
    return res;
  }
  if (s[i] == s[j]) {
    res = 2 + solve(i + 1, j - 1);
    l[i][j] = make_pair(i + 1, j - 1);
  } else {
    if (solve(i + 1, j) > res) {
      res = solve(i + 1, j);
      l[i][j] = make_pair(i + 1, j);
    }
    if (solve(i, j - 1) > res) {
      res = solve(i, j - 1);
      l[i][j] = make_pair(i, j - 1);
    }
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> s;
  for (auto i : s) {
    if (++cnt[i] >= 100) {
      while (cnt[i]--) {
        cout << i;
      }
      return 0;
    }
  }
  string t = "";
  int n = s.size(), pos = 0, x, y, m;
  solve(0, n - 1);
  for (pair<int, int> i = make_pair(0, n - 1); t.size() < 100; i = l[x][y]) {
    x = i.first;
    y = i.second;
    m = t.size() / 2;
    if (x != y && s[x] != s[y]) continue;
    if (x != y) {
      t = t.substr(0, m) + s[x] + s[y] + t.substr(m);
    } else {
      t = t.substr(0, m) + s[x] + t.substr(m);
    }
    if (x + 1 >= y) break;
  }
  cout << t;
  return 0;
}