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 = 1e5 + 5;
const int mod = 1e9 + 7;
const int inf = 1e9;
const int del = 728729;
string lcs(string &X, string &Y) {
  int m = X.length();
  int n = Y.length();
  int dp[m + 1][n + 1];
  for (int i = 0; i <= m; i++) {
    for (int j = 0; j <= n; j++) {
      if (i == 0 or j == 0)
        dp[i][j] = 0;
      else if (X[i - 1] == Y[j - 1])
        dp[i][j] = dp[i - 1][j - 1] + 1;
      else
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    }
  }
  int index = dp[m][n];
  string lcs(index, '\0');
  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 (dp[i - 1][j] > dp[i][j - 1])
      i--;
    else
      j--;
  }
  string ans;
  if (lcs.size() >= 100) {
    for (int i = 0; i < 50; i++) {
      ans += lcs[i];
    }
    for (int i = lcs.size() - 50; i < lcs.size(); i++) {
      ans += lcs[i];
    }
    return ans;
  } else
    return lcs;
}
string longestPalSubseq(string &str) {
  string rev = str;
  reverse(rev.begin(), rev.end());
  return lcs(str, rev);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  string str;
  cin >> str;
  int n = str.size();
  if (n <= 2600) {
    cout << longestPalSubseq(str);
  } else {
    map<char, int> mp;
    for (int i = 0; i < n; i++) {
      mp[str[i]]++;
    }
    for (int i = 'a'; i <= 'z'; i++) {
      if (mp[i] >= 100) {
        for (int j = 0; j < 100; j++) {
          cout << (char)i;
        }
        return 0;
      }
    }
  }
}
