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>
const long long MAXN = 1e6 + 1;
const long long MOD = 1e9 + 7;
using namespace std;
long long readInt() {
  bool minus1 = false;
  long long result = 0;
  char ch;
  ch = getchar();
  while (true) {
    if (ch == '-') break;
    if (ch >= '0' && ch <= '9') break;
    ch = getchar();
  }
  if (ch == '-')
    minus1 = true;
  else
    result = ch - '0';
  while (true) {
    ch = getchar();
    if (ch < '0' || ch > '9') break;
    result = result * 10 + (ch - '0');
  }
  if (minus1)
    return -result;
  else
    return result;
}
const int MNN = 3000 + 77;
int dp[MNN][MNN];
string s;
vector<int> pos;
void recover(int l, int r) {
  if (l > r) return;
  if (l == r && pos.size() < 100) {
    pos.push_back(l);
    return;
  }
  if (s[l] == s[r] && dp[l][r] == dp[l + 1][r - 1] + 2) {
    pos.push_back(l);
    pos.push_back(r);
    recover(l + 1, r - 1);
    return;
  }
  if (dp[l][r] == dp[l + 1][r]) {
    recover(l + 1, r);
  } else {
    recover(l, r - 1);
  }
}
int main() {
  cin >> s;
  map<char, int> cnt;
  int n = s.size();
  s = '$' + s;
  for (int i = 1; i <= n; i++) {
    cnt[s[i]]++;
  }
  for (char i = 'a'; i <= 'z'; i++) {
    if (cnt[i] >= 100) {
      for (int j = 1; j <= 100; j++) {
        cout << i;
      }
      return 0;
    }
  }
  for (int i = 1; i <= n; i++) dp[i][i] = 1;
  for (int len = 1; len <= n - 1; len++) {
    for (int i = 1; i + len <= n; i++) {
      int j = i + len;
      if (s[i] == s[j] && dp[i + 1][j - 1] <= 99) {
        dp[i][j] = dp[i + 1][j - 1] + 2;
      }
      dp[i][j] = max(dp[i][j - 1], max(dp[i][j], dp[i + 1][j]));
    }
  }
  recover(1, n);
  sort(pos.begin(), pos.end());
  for (int i : pos) {
    cout << s[i];
  }
  return 0;
}