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>
char s[50005];
int pd = 1, f[2605][2605];
void Print(int l, int r) {
  if (l > r)
    return;
  else if (l == r) {
    if (pd) printf("%c", s[l]);
  } else if (s[l] == s[r]) {
    printf("%c", s[l]);
    Print(l + 1, r - 1);
    printf("%c", s[r]);
  } else {
    if (f[l][r - 1] > f[l + 1][r])
      Print(l, r - 1);
    else
      Print(l + 1, r);
  }
}
int main() {
  scanf("%s", s + 1);
  int len = strlen(s + 1);
  if (len > 2600) {
    int count[32] = {0};
    for (int i = 1; i <= len; ++i) {
      ++count[s[i] - 'A'];
      if (count[s[i] - 'A'] >= 100) {
        for (int j = 1; j <= 100; ++j) printf("%c", s[i]);
        return 0;
      }
    }
  }
  for (int i = len; i; --i) {
    f[i][i] = 1;
    for (int j = i + 1; j <= len; ++j) {
      if (s[i] == s[j]) {
        f[i][j] = f[i + 1][j - 1] + 2;
      } else {
        f[i][j] = std::max(f[i + 1][j], f[i][j - 1]);
      }
      if (f[i][j] >= 100) {
        pd = 0;
        Print(i, j);
        return 0;
      }
    }
  }
  Print(1, len);
  return 0;
}