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 long long linf = 1e18 + 9;
const int inf = 1e9 + 9;
const int N = 3e3 + 9;
int dp[N][N];
int hash[N][N], h[N];
int d[N][N], d2[N][N];
string str, ans, ans2;
void print() {
  int bas = 0, son = str.size() - 1;
  while (bas <= son) {
    if (bas == son) {
      ans += str[bas];
      break;
    } else if (d[bas][son] == 1) {
      ans += str[bas];
      ans2 += str[son];
      bas++, son--;
    } else if (d[bas][son] == 2)
      son--;
    else
      bas++;
    if (ans.size() + ans2.size() == 100) break;
  }
  reverse(ans2.begin(), ans2.end());
  cout << ans << ans2 << endl;
}
int f(int bas, int son) {
  int &r = dp[bas][son];
  if (r != -1) return r;
  if (bas > son or son < bas or bas >= str.size() or son < 0) return r = 0;
  if (bas == son) {
    return r = 1;
  }
  if (str[bas] == str[son]) {
    r = 1;
    r += f(bas + 1, son - 1);
    r++;
    d[bas][son] = 1;
  } else {
    int mx1 = f(bas, son - 1);
    int mx2 = f(bas + 1, son);
    if (mx1 > mx2)
      d[bas][son] = 2;
    else
      d[bas][son] = 3;
    r = max(mx1, mx2);
  }
  return r;
}
int main() {
  cin >> str;
  for (int i = 0; i < str.size(); i++) h[str[i]]++;
  for (int i = 0; i < 26; i++) {
    if (h[i + 'a'] >= 100) {
      for (int j = 1; j <= min(100, h[i + 'a']); j++) {
        cout << (char)(i + 'a');
      }
      return 0;
    }
  }
  memset(dp, -1, sizeof dp);
  f(0, str.size() - 1);
  print();
  return 0;
}