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 x;
int dp[2601][2601], n;
string r, l;
int calc(int i, int j) {
  if (i >= j || i == n || j == -1) return i == j;
  if (dp[i][j] != -1) return dp[i][j];
  int a = -1000000;
  if (x[i] == x[j]) a = calc(i + 1, j - 1) + 2;
  return dp[i][j] = max(a, max(calc(i + 1, j), calc(i, j - 1)));
}
int s;
void print(int i, int j) {
  if (i == n || j == -1)
    return;
  else if (s % 2 == 1 && i > j)
    return;
  else if (s % 2 == 0 && i >= j)
    return;
  int a, b, c;
  a = b = c = -1000000;
  if (x[i] == x[j]) a = calc(i + 1, j - 1) + 2;
  b = calc(i + 1, j);
  c = calc(i, j - 1);
  if (a == max(a, max(b, c))) {
    r += x[i];
    print(i + 1, j - 1);
    if (s % 2) {
      if (i != j) l += x[j];
    } else
      l += x[j];
  } else if (b == max(a, max(b, c)))
    print(i + 1, j);
  else
    print(i, j - 1);
}
int freq[27];
int main() {
  cin >> x;
  n = x.size();
  int ans = -1;
  for (int i = 0; i < n; ++i) ++freq[x[i] - 'a'];
  for (int i = 0; i < 26; ++i)
    if (freq[i] >= 100) ans = i;
  if (ans != -1) {
    for (int i = 0; i < 100; ++i) cout << (char)(ans + 'a');
    return 0;
  }
  memset(dp, -1, sizeof(dp));
  s = calc(0, n - 1);
  print(0, n - 1);
  if (s < 100) {
    cout << r << l << endl;
    return 0;
  }
  string r1, r2;
  for (int i = 0; i < 50; ++i) r1 += r[i];
  for (int i = (signed)l.size() - 50; i < l.size(); ++i) r2 += l[i];
  cout << r1 + r2;
}
