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;
const int MAXL = 3000;
string str;
int N;
int dp[MAXL][MAXL];
bool pr[MAXL][MAXL];
int getdp(int a, int b) {
  int &ref = dp[a][b];
  if (ref != -1) {
    return ref;
  }
  if (a == b) {
    return ref = 1;
  }
  if (str[a] != str[b]) {
    int dp1 = getdp(a + 1, b), dp2 = getdp(a, b - 1);
    if (dp1 > dp2) {
      return ref = dp1;
    }
    return ref = dp2;
  }
  if (b == a + 1) {
    return ref = 2;
  }
  return ref = getdp(a + 1, b - 1) + 2;
}
string ans;
void print(int a, int b) {
  bool &ref = pr[a][b];
  if (ref) {
    return;
  }
  ref = true;
  if (a == b) {
    ans += str[a];
    return;
  }
  if (str[a] != str[b]) {
    if (dp[a + 1][b] == dp[a][b]) {
      print(a + 1, b);
    } else {
      print(a, b - 1);
    }
    return;
  }
  if (b == a + 1) {
    ans.append(2, str[a]);
    return;
  }
  ans += str[a];
  print(a + 1, b - 1);
  ans += str[b];
}
int main() {
  cin >> str;
  N = str.length();
  for (char i = 'a'; i <= 'z'; i++) {
    int occ = 0;
    for (int j = 0; j < N; j++) {
      occ += (str[j] == i);
      if (occ == 100) {
        for (int k = 0; k < 100; k++) {
          cout << i;
        }
        return 0;
      }
    }
  }
  memset(dp, -1, sizeof(dp));
  getdp(0, N - 1);
  print(0, N - 1);
  N = ans.length();
  if (N <= 100) {
    cout << ans;
    return 0;
  }
  for (int i = 0; i < 50; i++) {
    cout << ans[i];
  }
  for (int i = 49; i >= 0; i--) {
    cout << ans[i];
  }
}