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 maxn = 50010;
int you[maxn][26];
int dp[101][maxn];
char s[110000];
void dfs(int l, int r, int k) {
  if (k == 1) {
    printf("%c", s[l]);
    return;
  }
  if (k == 2) {
    printf("%c%c", s[l], s[r]);
    return;
  }
  printf("%c", s[l]);
  int i;
  for (i = l + 1; dp[k - 2][i] >= r; i++)
    ;
  dfs(i, dp[k - 2][i], k - 2);
  printf("%c", s[r]);
}
int main() {
  int n, i, j, k;
  scanf("%s", s);
  n = strlen(s);
  for (i = 0; i < 26; i++) you[n][i] = n;
  for (i = n - 1; i >= 0; i--) {
    memcpy(you[i], you[i + 1], sizeof(you[i]));
    you[i][s[i] - 'a'] = i;
  }
  int M = 1;
  for (i = 0; i < n; i++) {
    dp[1][i] = i;
    dp[2][i] = you[i + 1][s[i] - 'a'];
    if (dp[2][i] < n) M = 2;
  }
  for (i = 3; i <= 100; i++) {
    int now = n;
    for (j = n - 1; j >= 0; j--) {
      if (now < n - 1 && you[now + 1][s[j] - 'a'] < n)
        M = i, dp[i][j] = you[now + 1][s[j] - 'a'];
      else
        dp[i][j] = n;
      now = min(dp[i - 2][j], now);
    }
  }
  for (i = 0; dp[M][i] >= n; i++)
    ;
  dfs(i, dp[M][i], M);
  puts("");
}