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 = (int)1e5 + 100;
const int mod = (int)1e9 + 7;
const int P = (int)1e6 + 7;
int n, cnt[33], dp[2666][2666];
pair<int, int> par[2666][2666];
char second[maxn];
int calc(int l, int r) {
  if (l > r) return 0;
  if (l == r) return 1;
  int &res = dp[l][r];
  if (res != -1) return res;
  res = -mod;
  if (second[l] == second[r]) {
    res = calc(l + 1, r - 1) + 2;
    par[l][r] = make_pair(l + 1, r - 1);
  }
  if (calc(l + 1, r) > res) {
    res = calc(l + 1, r);
    par[l][r] = make_pair(l + 1, r);
  }
  if (res < calc(l, r - 1)) {
    res = calc(l, r - 1);
    par[l][r] = make_pair(l, r - 1);
  }
  return res;
}
string path(int l, int r) {
  if (l > r) return "";
  if (l == r) {
    string cur = "";
    cur += second[l];
    return cur;
  }
  pair<int, int> p = par[l][r];
  int pl = p.first, pr = p.second;
  string ans = "";
  if (l != pl && r != pr) {
    ans = second[l] + path(pl, pr) + second[r];
  } else {
    ans = path(pl, pr);
  }
  return ans;
}
int main() {
  scanf("%s", second + 1);
  n = strlen(second + 1);
  for (int i = (1); i <= (n); ++i) {
    cnt[second[i] - 'a']++;
    if (cnt[second[i] - 'a'] == 100) {
      while (cnt[second[i] - 'a']--) cout << second[i];
      return 0;
    }
  }
  memset(dp, -1, sizeof(dp));
  calc(1, n);
  string ans = path(1, n);
  if (((int)(ans).size()) <= 100)
    cout << ans;
  else {
    int m = ((int)(ans).size());
    string ss = "";
    for (int i = (0); i <= (49); ++i) ss += ans[i];
    cout << ss;
    reverse((ss).begin(), (ss).end());
    cout << ss;
  }
}