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;
struct cell {
  int x, y;
};
const int NMAX = 50005;
const int XMAX = 2600;
char s[NMAX];
int frecv[200];
char a[NMAX], b[NMAX];
int aa, bb;
int dp[XMAX][XMAX];
cell NEXT[XMAX][XMAX];
inline int DP(int st, int dr) {
  if (dp[st][dr]) return dp[st][dr];
  if (st == dr) {
    dp[st][dr] = 1;
    return 1;
  }
  if (st == dr - 1) {
    dp[st][dr] = 1;
    if (s[st] == s[dr]) dp[st][dr]++;
    return dp[st][dr];
  }
  dp[st][dr] = DP(st, dr - 1);
  NEXT[st][dr].x = st;
  NEXT[st][dr].y = dr - 1;
  if (DP(st + 1, dr) > dp[st][dr]) {
    dp[st][dr] = dp[st + 1][dr];
    NEXT[st][dr].x = st + 1;
    NEXT[st][dr].y = dr;
  }
  if (s[st] == s[dr] && (DP(st + 1, dr - 1) + 2) > dp[st][dr]) {
    dp[st][dr] = dp[st + 1][dr - 1] + 2;
    NEXT[st][dr].x = st + 1;
    NEXT[st][dr].y = dr - 1;
  }
  return dp[st][dr];
}
inline void Reconstituire(int st, int dr) {
  if (NEXT[st][dr].x == 0) {
    a[++aa] = s[st];
    return;
  }
  if (NEXT[st][dr].x == st + 1 && NEXT[st][dr].y == dr - 1) a[++aa] = s[st];
  Reconstituire(NEXT[st][dr].x, NEXT[st][dr].y);
}
int main() {
  int i, len, j, n;
  cin.sync_with_stdio(false);
  cin >> (s + 1);
  len = strlen(s + 1);
  for (i = 1; i <= len; i++) frecv[s[i]]++;
  for (i = 1; i < 200; i++)
    if (frecv[i] >= 100) {
      for (j = 1; j <= 100; j++) cout << (char)i;
      cout << "\n";
      return 0;
    }
  n = DP(1, len);
  Reconstituire(1, len);
  for (i = aa; i >= 1; i--) b[++bb] = a[i];
  if (n < 100) {
    cout << (a + 1);
    if (n % 2 == 0)
      cout << (b + 1);
    else
      cout << (b + 2);
  } else {
    if (n % 2 == 0) {
      for (i = 50; i >= 1; i--) cout << b[i];
      for (i = 1; i <= 50; i++) cout << b[i];
    } else {
      for (i = 51; i >= 2; i--) cout << b[i];
      for (i = 2; i <= 51; i++) cout << b[i];
    }
  }
  return 0;
}