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;
const long long MOD = 1000000000 + 7;
const long long alphabet = 256;
int dp[26];
string lcs(string X, string Y) {
  int m = X.length();
  int n = Y.length();
  int L[m + 1][n + 1];
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= n; j++) {
      if (i == 0 || j == 0)
        L[i][j] = 0;
      else if (X[i - 1] == Y[j - 1])
        L[i][j] = L[i - 1][j - 1] + 1;
      else
        L[i][j] = max(L[i - 1][j], L[i][j - 1]);
    }
  }
  int index = L[m][n];
  string lcs(index + 1, ' ');
  int i = m, j = n;
  while (i > 0 && j > 0) {
    if (X[i - 1] == Y[j - 1]) {
      lcs[index - 1] = X[i - 1];
      i--;
      j--;
      index--;
    } else if (L[i - 1][j] > L[i][j - 1])
      i--;
    else
      j--;
  }
  return lcs;
}
string longestPalSubseq(string str) {
  string rev = str;
  reverse(rev.begin(), rev.end());
  return lcs(str, rev);
}
int main() {
  string s;
  cin >> s;
  int n = s.length();
  for (int i = 0; i < n; i++) {
    dp[s[i] - 'a']++;
  }
  for (int i = 0; i < 26; i++) {
    if (dp[i] >= 100) {
      char c = 'a' + i;
      for (int j = 0; j < 100; j++) {
        cout << c;
      }
      return 0;
    }
  }
  string temp = longestPalSubseq(s);
  int l = temp.length();
  l--;
  string ans = temp.substr(0, l);
  if (l <= 100)
    cout << ans;
  else {
    int len = 50;
    for (int i = 0; i < 50; i++) cout << ans[i];
    for (int i = l - 50; i < l; i++) cout << ans[i];
  }
}