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 str[51234];
int L[51234][123];
int P[51234][27];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> str;
  int n = strlen(str);
  for (int i = 0; i < 26; ++i) {
    int w = n;
    P[n][i] = 0x3f3f3f3f;
    for (int j = n - 1; j >= 0; --j) {
      if (str[j] - 'a' == i) w = j;
      P[j][i] = w;
    }
  }
  for (int i = 0; i <= n; ++i) {
    L[i][0] = i - 1;
    L[i][1] = i;
  }
  int maxLen = 1;
  for (int k = 2; k <= 100; ++k) {
    L[n][k] = 0x3f3f3f3f;
    for (int i = n - 1; i >= 0; --i) {
      L[i][k] = L[i + 1][k];
      int t = L[i + 1][k - 2] + 1;
      if (t < n) {
        L[i][k] = min(L[i][k], P[t][str[i] - 'a']);
      }
    }
    if (L[0][k] < n) maxLen = k;
  }
  int d = maxLen;
  int x = 0;
  int cnt = 0;
  char pa[110];
  while (d > 0) {
    while (L[x][d] == L[x + 1][d]) x++;
    pa[cnt] = pa[maxLen - cnt - 1] = str[x];
    x++;
    cnt++;
    d -= 2;
  }
  pa[maxLen] = 0;
  cout << pa << endl;
  return 0;
}
