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;
map<long long, bool> visi;
int ar[1000001];
char str[100001], str2[1000001];
int table[5000][5000];
vector<int> vec;
int n;
void cal(int i, int j) {
  int mx;
  if (i > j) return;
  if (i == j) {
    vec.push_back(i);
    return;
  }
  mx = max(table[i][j - 1], table[i + 1][j]);
  if (mx == table[i][j]) {
    if (mx == table[i][j - 1])
      cal(i, j - 1);
    else
      cal(i + 1, j);
  } else {
    vec.push_back(i);
    vec.push_back(j);
    cal(i + 1, j - 1);
  }
}
int lol;
int main() {
  int i, j, m, a, c, b, d, ck, t, r, x, y, ans, rem, cnt, lo, hi, sum, cs = 1;
  scanf("%s", str);
  n = strlen(str);
  if (n > 3000) n = 3000;
  for (i = 0; i < n; i++) str2[i + 1] = str[i];
  str2[n + 1] = '\0';
  for (i = 1; i <= n; i++) table[i][i] = 1;
  ck = 0;
  for (i = 2; i <= n; i++) {
    x = 1;
    j = i;
    while (j <= n) {
      if (str2[x] == str2[j]) {
        table[x][j] = table[x + 1][j - 1] + 2;
        if (table[x][j] >= 100) {
          ck = j;
          break;
        }
      } else
        table[x][j] = max(table[x + 1][j], table[x][j - 1]);
      x++;
      j++;
    }
    if (ck) break;
  }
  if (ck) {
    cal(x, ck);
    ans = vec.size() - 100;
    if (ans % 2 == 0) {
      ans = ans / 2;
      sort(vec.begin(), vec.end());
      for (i = ans; i < vec.size() - ans; i++) cout << str2[vec[i]];
    } else {
      cnt = 0;
      ans = ans - 1;
      ans = ans / 2;
      x = vec.size() / 2;
      sort(vec.begin(), vec.end());
      for (i = ans; i < vec.size() - ans; i++) {
        if (i != x) {
          cout << str2[vec[i]];
        }
      }
    }
  } else {
    cal(1, n);
    sort(vec.begin(), vec.end());
    for (i = 0; i < vec.size(); i++) cout << str2[vec[i]];
  }
}