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 N = 2605;
int dp[N][N];
int path[N][N];
string str;
vector<char> res;
void getstr(int x, int y) {
  if (path[x][y] == 0) {
    getstr(x - 1, y - 1);
    res.push_back(str[x - 1]);
  } else if (path[x][y] == 1) {
    getstr(x - 1, y);
  } else if (path[x][y] == 2) {
    getstr(x, y - 1);
  }
}
void solve(string str2) {
  string str1 = str2;
  reverse(str1.begin(), str1.end());
  memset(dp, 0, sizeof(dp));
  memset(path, -1, sizeof(path));
  int n = str1.length();
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      int ii = i - 1;
      int jj = j - 1;
      if (str2[ii] == str1[jj]) {
        path[i][j] = 0;
        dp[i][j] = dp[ii][jj] + 1;
      } else {
        if (dp[ii][j] > dp[i][jj]) {
          dp[i][j] = dp[ii][j];
          path[i][j] = 1;
        } else {
          dp[i][j] = dp[i][jj];
          path[i][j] = 2;
        }
      }
    }
  }
  getstr(n, n);
  if (res.size() < 100) {
    for (int i = 0; i < res.size(); i++) {
      cout << res[i];
    }
  } else {
    for (int i = 0; i < 50; i++) {
      cout << res[i];
    }
    for (int i = res.size() - 50; i < res.size(); i++) {
      cout << res[i];
    }
  }
  cout << endl;
}
int main() {
  cin >> str;
  if (str.length() < N) {
    solve(str);
  } else {
    int cont[30];
    memset(cont, 0, sizeof(cont));
    for (int i = 0; i < str.length(); i++) {
      cont[str[i] - 'a']++;
    }
    int maxs = -1;
    for (int i = 0; i < 26; i++)
      if (cont[i] >= 100) maxs = i;
    char ch = 'a' + maxs;
    for (int i = 0; i < 100; i++) cout << ch;
    cout << endl;
  }
  return 0;
}