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;
string s;
bool v[2601][2601];
string dp[2601][2601];
void solve(int i, int j) {
  if (i == j) {
    dp[i][j] = string("") + s[i];
    return;
  }
  if (i > j) {
    dp[i][j] = string("");
    return;
  }
  string &ret = dp[i][j];
  if (v[i][j]) return;
  v[i][j] = 1;
  ret = "";
  solve(i + 1, j);
  solve(i, j - 1);
  solve(i + 1, j - 1);
  if (dp[i + 1][j].length() > ret.length()) ret = dp[i + 1][j];
  if (dp[i][j - 1].length() > ret.length()) ret = dp[i][j - 1];
  if (s[i] == s[j] && dp[i + 1][j - 1].length() + 2 > ret.length()) {
    if (dp[i + 1][j - 1].length() > 120)
      ret = dp[i + 1][j - 1];
    else
      ret = s[i] + dp[i + 1][j - 1] + s[j];
  }
}
int main() {
  cin >> s;
  if (s.length() > 2600) {
    vector<int> f(26, 0);
    for (int i = 0; i < s.length(); i++) f[s[i] - 'a']++;
    for (int i = 0; i < 26; i++)
      if (f[i] >= 100) {
        cout << string(100, 'a' + i) << endl;
        return 0;
      }
  }
  memset(v, 0, sizeof v);
  solve(0, s.length() - 1);
  string cur = dp[0][s.length() - 1];
  while (cur.length() > 101) cur = cur.substr(1, cur.length() - 2);
  if (cur.length() == 101)
    cur = cur.substr(0, cur.length() / 2) + cur.substr(cur.length() / 2 + 1);
  cout << cur << endl;
}
