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 long long N = 2002;
bool isPal(string s) {
  long long n = s.size();
  for (long long i = 0; i < n / 2; ++i)
    if (s[i] != s[n - i - 1]) return false;
  return true;
}
string lcs(string s) {
  long long n = s.size();
  long long dp[n + 1][n + 1];
  memset(dp, 0, sizeof dp);
  for (long long i = 1; i <= n; ++i) {
    for (long long j = 1; j <= n; ++j) {
      if (s[i - 1] == s[n - j]) {
        dp[i][j] = dp[i - 1][j - 1] + 1;
      } else
        dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
    }
  }
  string ans = "";
  long long i = n, j = n;
  while (i && j) {
    if (s[i - 1] == s[n - j])
      ans.push_back(s[i - 1]), --i, --j;
    else if (dp[i - 1][j] > dp[i][j - 1])
      --i;
    else
      --j;
  }
  if (ans.size() > 100) {
    long long n = ans.size();
    if (n & 1) ans.erase(ans.begin() + n / 2);
    while (ans.size() > 100) {
      ans.erase(ans.begin());
      ans.pop_back();
    }
  }
  return ans;
}
void solve() {
  string s;
  cin >> s;
  string val = "";
  string ans = "";
  if (s.size() < 2600) ans = lcs(s);
  vector<long long> fre(26);
  for (char c : s) fre[c - 'a']++;
  for (long long i = 0; i < 26; ++i)
    if (fre[i] >= 100) val = string(100, i + 'a');
  if (val.size() == 100) ans = val;
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
}
