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;
string s;
int mem[2601][2601];
int solve(int l, int r) {
  if (r < l) return 0;
  if (l == r) return 1;
  if (mem[l][r] != -1) return mem[l][r];
  int ans;
  if (s[l] == s[r])
    ans = solve(l + 1, r - 1) + 2;
  else
    ans = 0;
  return mem[l][r] = max(max(solve(l + 1, r), solve(l, r - 1)), ans);
}
string trace(int l, int r) {
  if (r < l) return "";
  if (r == l) return s.substr(l, 1);
  if (s[l] == s[r] && solve(l, r) == solve(l + 1, r - 1) + 2)
    return s.substr(l, 1) + trace(l + 1, r - 1) + s.substr(r, 1);
  if (solve(l, r) == solve(l + 1, r)) return trace(l + 1, r);
  return trace(l, r - 1);
}
int main() {
  cin >> s;
  for (int i = 0; i < 26; i++) {
    int c = 0;
    for (int j = 0; j < s.size(); j++) c += s[j] - 'a' == i;
    if (c >= 100) {
      for (int j = 0; j < 100; j++) cout << char('a' + i);
      cout << endl;
      return 0;
    }
  }
  memset(mem, -1, sizeof mem);
  solve(0, s.size() - 1);
  string y = trace(0, s.size() - 1);
  if (y.size() > 100) {
    for (int i = 0; i < 50; i++) cout << y[i];
    for (int i = 49; i >= 0; i--) cout << y[y.size() - i - 1];
    cout << endl;
  } else
    cout << y << endl;
  return 0;
}