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.
#include <bits/stdc++.h>
using namespace std;
char base[100005];
char rev[100005];
int occ[100];
int mx[3000][3000];
char recon[3000];
int itr;
void rek(int i, int j) {
  if (i * j == 0) return;
  if (base[i] == rev[j]) {
    itr++;
    recon[itr] = base[i];
    rek(i - 1, j - 1);
  } else {
    if (mx[i - 1][j] > mx[i][j - 1])
      rek(i - 1, j);
    else
      rek(i, j - 1);
  }
}
int main() {
  scanf("%s", base + 1);
  int pl = 1;
  while (base[pl + 1]) pl++;
  if (pl > 26 * 100) {
    for (int i = 1; i <= pl; i++) occ[base[i] - 'a']++;
    int sol = 0;
    while (occ[sol] < 100) sol++;
    for (int i = 1; i <= 100; i++) printf("%c", 'a' + sol);
    return 0;
  }
  for (int i = 1; i <= pl; i++) rev[i] = base[i];
  reverse(rev + 1, rev + pl + 1);
  for (int i = 1; i <= pl; i++)
    for (int j = 1; j <= pl; j++) {
      mx[i][j] = max(mx[i][j - 1], mx[i - 1][j]);
      if (base[i] == rev[j]) mx[i][j] = max(mx[i][j], mx[i - 1][j - 1] + 1);
    }
  int si, sj;
  si = sj = pl;
  rek(pl, pl);
  if (itr <= 100) {
    printf("%s", recon + 1);
    return 0;
  }
  for (int i = 1; i <= 50; i++) printf("%c", recon[i]);
  for (int i = 49; i >= 0; i--) printf("%c", recon[itr - i]);
}
