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 a[500005], soll[2605 * 2605];
int dp[2605][2605], lensol, fr[100];
int main() {
  int i, j, N, sol = 0, st, dr, aux, ok = 0;
  scanf("%s", (a + 1));
  N = strlen(a + 1);
  if (N > 99 * 26) {
    for (i = 1; i <= N; ++i) ++fr[a[i] - 'a'];
    for (i = 0; i < 26; ++i)
      if (fr[i] >= 100) {
        for (j = 1; j <= 100; ++j) printf("%c", i + 'a');
        printf("\n");
        break;
      }
  } else {
    for (i = 1; i < N; ++i)
      for (j = N; j > i; --j)
        if (a[i] == a[j])
          dp[i][j] = dp[i - 1][j + 1] + 1;
        else
          dp[i][j] = max(dp[i - 1][j], dp[i][j + 1]);
    for (i = 2; i < N; ++i)
      if (sol < 1 + dp[i - 1][i + 1]) {
        sol = 1 + dp[i - 1][i + 1];
        st = dr = i;
      }
    for (i = 2; i < N; ++i)
      for (j = i + 1; j < N; ++j)
        if (a[i] == a[j]) {
          if (sol < 2 + dp[i - 1][j + 1]) {
            sol = 2 + dp[i - 1][j + 1];
            st = i;
            dr = j;
          }
          if (2 + dp[i - 1][j + 1] * 2 >= 100) {
            ok = 1;
            st = i;
            dr = j;
            break;
          }
        }
    if (st == dr)
      aux = 2;
    else
      aux = 1;
    if (!sol)
      printf("%c\n", a[1]);
    else {
      while (dr <= N && st) {
        if (a[st] == a[dr]) {
          soll[++lensol] = a[dr];
          --st;
          ++dr;
        } else if (dp[st - 1][dr] > dp[st][dr + 1])
          --st;
        else
          ++dr;
        if (ok && lensol == 50) break;
      }
      for (i = lensol; i >= aux; --i) printf("%c", soll[i]);
      for (i = 1; i <= lensol; ++i) printf("%c", soll[i]);
    }
  }
  return 0;
}
