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 inf = 1e9 + 5143;
const long long Linf = 1e18 + 5413;
template <class T>
inline void umax(T &a, T b) {
  if (a < b) a = b;
}
template <class T>
inline void umin(T &a, T b) {
  if (a > b) a = b;
}
template <class T>
inline T abs(T a) {
  return a > 0 ? a : -a;
}
template <class T>
inline T lcm(T a, T b) {
  return a / __gcd(a, b) * b;
}
inline int read() {
  int res = 0;
  int neg;
  while (true) {
    char ch = getchar();
    if (ch >= '0' && ch <= '9' || ch == '-') {
      if (ch == '-')
        neg = -1;
      else
        neg = 1, res = ch - '0';
      break;
    }
  }
  while (true) {
    char ch = getchar();
    if (ch >= '0' && ch <= '9')
      res *= 10, res += ch - '0';
    else
      break;
  }
  return res * neg;
}
const int MAXN = 1e5 + 5;
char s[MAXN];
int N;
int cnt[26];
void f() {
  for (int(i) = (1); (i) <= (N); (i)++) cnt[s[i] - 'a']++;
  int id = -1, ans = 0;
  for (int(i) = (0); (i) < (26); (i)++)
    if (cnt[i] > ans) {
      ans = cnt[i];
      id = i;
    }
  assert(ans >= 100);
  for (int(i) = (1); (i) <= (100); (i)++) printf("%c", id + 'a');
  puts("");
}
int dp[3000][3000];
char t[MAXN];
string res;
void out(int x, int y, int k) {
  if (k == 0) return;
  if (s[x] == t[y]) {
    res += s[x];
    out(x - 1, y - 1, k - 1);
    return;
  }
  if (dp[x - 1][y] > dp[x][y - 1])
    out(x - 1, y, k);
  else
    out(x, y - 1, k);
}
int main() {
  scanf(" %s", s + 1);
  N = strlen(s + 1);
  if (N >= 2600) {
    f();
    return 0;
  }
  for (int(i) = (1); (i) <= (N); (i)++) t[i] = s[i];
  reverse(t + 1, t + 1 + N);
  for (int(i) = (1); (i) <= (N); (i)++)
    for (int(j) = (1); (j) <= (N); (j)++)
      if (s[i] == t[j])
        dp[i][j] = dp[i - 1][j - 1] + 1;
      else
        dp[i][j] = max(dp[i][j - 1], dp[i - 1][j]);
  out(N, N, dp[N][N]);
  if (res.size() > 100) {
    if (res.size() & 1) {
      res.erase(res.begin() + res.size() / 2);
    }
    int x = res.size();
    int k = (x - 100) / 2;
    for (int(i) = (k); (i) <= (k + 100 - 1); (i)++) printf("%c", res[i]);
    puts("");
  } else {
    cout << res << endl;
  }
  return 0;
}