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;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\n";
  err(++it, args...);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin.tie(NULL);
  long long int n, m, i, j, k, ans = 0;
  string s;
  cin >> s;
  n = s.size();
  if (n >= 2600) {
    long long int f[250];
    for (int str_var_freq = 0; str_var_freq < 250; str_var_freq++)
      f[str_var_freq] = 0;
    for (int str_var_freq = 0; str_var_freq < s.size(); str_var_freq++) {
      f[s[str_var_freq] - '\0']++;
    }
    for (i = 0; i < 250; i++)
      if (f[i] >= 100) {
        for (j = 0; j < 100; j++) cout << (char)('\0' + i);
        break;
      }
  } else {
    vector<vector<long long int> > dp(n, vector<long long int>(n, 0));
    for (i = 0; i < n; i++) dp[i][i] = 1;
    for (int len = 1; len < n; len++) {
      for (i = 0; i + len < n; i++) {
        dp[i][i + len] = max({dp[i][i + len - 1], dp[i + 1][i + len]});
        if (s[i] == s[i + len])
          dp[i][i + len] = max(dp[i][i + len], 2 + dp[i + 1][i + len - 1]);
      }
    }
    long long int start = 0, end = n - 1, cur = dp[0][n - 1], flag = true;
    string res, ext;
    while (start <= end) {
      if (s[start] == s[end]) {
        if (start != end)
          res += s[start];
        else
          ext += s[start];
        start++, end--;
        cur -= 2;
      } else if (dp[start + 1][end - 1] == cur) {
        start++, end--;
      } else if (dp[start + 1][end] == cur) {
        start++;
      } else
        end--;
    }
    if (res.size() >= 50) {
      res = res.substr(0, 50);
      cout << res;
      reverse(res.begin(), res.end());
      cout << res;
    } else {
      cout << res << ext;
      reverse(res.begin(), res.end());
      cout << res << "\n";
    }
  }
  return 0;
}