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 MOD = 1000000007LL;
string s;
void najdi() {
  vector<int> tr(26, 0);
  for (int i = 0, _n = s.length(); i < _n; i++) tr[(int)(s[i] - 'a')]++;
  for (int i = 0, _n = 26; i < _n; i++) {
    if (tr[i] >= 100) {
      for (int j = 0, _n = 100; j < _n; j++) cout << (char)(i + 'a');
      cout << "\n";
      return;
    }
  }
}
int memo[2601][2601];
int dp(int l, int r) {
  if (memo[l][r] != -1) return memo[l][r];
  if (r < l) return 0;
  if (r == l) return 1;
  int ret = dp(l + 1, r);
  int r2 = dp(l, r - 1);
  if (r2 > ret) ret = r2;
  if (s[l] == s[r]) {
    r2 = 2 + dp(l + 1, r - 1);
    if (r2 > ret) ret = r2;
  }
  return memo[l][r] = ret;
}
string btrack(int l, int r) {
  if (r < l) return "";
  if (r == l) return s.substr(r, 1);
  if (s[l] == s[r] && dp(l + 1, r - 1) + 2 >= max(dp(l + 1, r), dp(l, r - 1)))
    return s[l] + btrack(l + 1, r - 1) + s[r];
  if (dp(l + 1, r) > dp(l, r - 1))
    return btrack(l + 1, r);
  else
    return btrack(l, r - 1);
}
int main() {
  cin >> s;
  if (s.length() > 2600) {
    najdi();
    return 0;
  }
  memset(memo, -1, sizeof(memo));
  int l = dp(0, s.length() - 1);
  string s2 = btrack(0, s.length() - 1);
  if (s2.length() <= 100) {
    cout << s2 << "\n";
    return 0;
  }
  for (int i = 0, _n = 50; i < _n; i++) cout << s2[i];
  for (int i = 49; i >= 0; i--) cout << s2[i];
  cout << "\n";
  return 0;
}
