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;
const int maxn = 3000 + 10;
void lps();
int len;
string a, b;
int alph[27];
vector<char> dp;
int dpl[maxn][maxn];
int parent[maxn][maxn];
int main() {
  cin >> a;
  len = a.length();
  if (len <= 3000) {
    b.resize(len);
    for (int i = 0; i < len; i++) b[i] = a[len - (i + 1)];
    lps();
  } else {
    for (int i = 0; i < 27; i++) alph[i] = 0;
    for (int i = 0; i < len; i++) {
      ++alph[int(a[i]) - int('a') + 1];
    }
    for (int i = 1; i < 27; i++) {
      if (alph[i] >= 100) {
        for (int j = 0; j < 100; j++) cout << char(i + 'a' - 1);
        return 0;
      }
    }
  }
  return 0;
}
void lps() {
  if (a[0] == b[0]) {
    dpl[1][1] = 1;
  } else
    dpl[1][1] = 0;
  for (int i = 0; i < maxn; i++)
    for (int j = 0; j < maxn; j++) parent[i][j] = -1;
  for (int i = 1; i <= len; i++) {
    for (int j = 1; j <= len; j++) {
      if (a[i - 1] == b[j - 1]) {
        dpl[i][j] = dpl[i - 1][j - 1] + 1;
        parent[i][j] = 0;
      } else {
        dpl[i][j] = max(dpl[i - 1][j], dpl[i][j - 1]);
        if (dpl[i - 1][j] > dpl[i][j - 1])
          parent[i][j] = 1;
        else
          parent[i][j] = 2;
      }
    }
  }
  int k1 = len, k2 = len;
  while (parent[k1][k2] != -1) {
    switch (parent[k1][k2]) {
      case 0:
        dp.push_back(a[k1 - 1]);
        k1--;
        k2--;
        break;
      case 1:
        k1--;
        break;
      case 2:
        k2--;
        break;
    }
  }
  if (int(dp.size()) <= 100) {
    for (int i = 0; i < int(dp.size()); i++) cout << dp[i];
  } else {
    for (int i = 0; i < 50; i++) cout << dp[i];
    for (int i = 49; i > -1; i--) cout << dp[int(dp.size()) - i - 1];
  }
  return;
}
