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;
#pragma comment(linker, "/STACK:255000000")
bool firstout = 1;
template <class T>
T &minn(T &a, T b) {
  if (b < a) a = b;
  return a;
}
template <class T>
T &maxx(T &a, T b) {
  if (a < b) a = b;
  return a;
}
int &madd(int &a, int b) {
  a += b;
  if (a >= 1000000007) a -= 1000000007;
  return a;
}
int &msub(int &a, int b) {
  a -= b;
  if (a < 0) a += 1000000007;
  return a;
}
int &mmult(int &a, int b) { return a = (long long)a * b % 1000000007; }
int mdiv(long long a, long long b, long long m) {
  a = (a % m + m) % m;
  b = (b % m + m) % m;
  if (a % b == 0) return a / b;
  return (a + m * mdiv(-a, m, b)) / b;
}
int n, m, q;
char S[50123];
int D[2612][2612];
char R[50123];
int fnd(int i, int j) {
  int &res = D[i][j];
  if (res >= 0) return res;
  if (i == 0 || j == n) return res = 0;
  if (S[i - 1] == S[j]) return res = fnd(i - 1, j + 1) + 1;
  return res = max(fnd(i - 1, j), fnd(i, j + 1));
}
void fnddfs(int i, int j) {
  const int &res = D[i][j];
  if (i == 0 || j == n) return;
  if (S[i - 1] == S[j]) {
    R[res - 1] = S[j];
    fnddfs(i - 1, j + 1);
    return;
  }
  if (res == fnd(i - 1, j)) {
    fnddfs(i - 1, j);
    return;
  }
  if (res == fnd(i, j + 1)) {
    fnddfs(i, j + 1);
    return;
  }
}
int main() {
  int i, j, k;
  char c;
  int a, d;
  int ts;
  for (ts = 1; scanf("%"
                     "s",
                     &(S)) > 0;
       ++ts) {
    n = strlen(S);
    if (n >= 2600) {
      for (c = ('a'); c < ('z' + 1); ++c) {
        int r = 0;
        for (i = (0); i < (n); ++i) r += S[i] == c;
        if (r >= 100) break;
      }
      for (i = (0); i < (100); ++i)
        printf(
            "%"
            "c",
            (c));
      printf("\n"), firstout = 1;
    } else {
      for (i = (0); i < (n + 1); ++i)
        for (j = (0); j < (n + 1); ++j) D[i][j] = -1;
      int res = 0;
      int ir = -1;
      for (i = (0); i < (n); ++i) {
        int r = 2 * fnd(i, i);
        if (r > res) {
          res = r;
          ir = i;
        }
      }
      for (i = (0); i < (n); ++i) {
        int r = 2 * fnd(i, i + 1) + 1;
        if (r > res) {
          res = r;
          ir = i;
        }
      }
      if (res & 1)
        fnddfs(ir, ir + 1);
      else
        fnddfs(ir, ir);
      R[res / 2] = 0;
      if (res >= 100) {
        d = res / 2 - 50;
        for (i = (0); i < (50); ++i) R[i] = R[i + d];
        R[i] = 0;
        res = 100;
      }
      printf(
          "%"
          "s",
          (R));
      reverse(R, R + res / 2);
      if (res & 1)
        printf(
            "%"
            "c",
            (S[ir]));
      printf(
          "%"
          "s",
          (R));
      printf("\n"), firstout = 1;
    }
  }
  return 0;
}