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;
inline int ___INT() {
  int ret;
  scanf("%d", &ret);
  return ret;
}
char str[50005];
int dp[2606][2606];
int F(int u, int v) {
  if (u > v) return 0;
  if (u == v) return 1;
  int& ret = dp[u][v];
  if (ret > -1) return ret;
  ret = 0;
  if (str[u] == str[v]) ret = max(ret, 2 + F(u + 1, v - 1));
  ret = max(ret, max(F(u + 1, v), F(u, v - 1)));
  return ret;
}
char buff[50005];
int K;
void Print(int u, int v) {
  if (u > v) return;
  if (u == v) {
    buff[K++] = str[u];
    return;
  }
  int a = 0;
  if (str[u] == str[v]) a = F(u + 1, v - 1) + 2;
  int b = F(u + 1, v);
  int c = F(u, v - 1);
  if (str[u] == str[v] && a > max(b, c)) {
    buff[K++] = str[u];
    Print(u + 1, v - 1);
    if (v > u) buff[K++] = str[v];
  } else if (b > c) {
    Print(u + 1, v);
  } else
    Print(u, v - 1);
}
int main() {
  scanf("%s", str);
  int len = strlen(str);
  int cnt[100];
  memset(cnt, (0), sizeof(cnt));
  for (int i = 0; i < (len); ++i) cnt[str[i] - 'a']++;
  for (int c = 0; c < (26); ++c)
    if (cnt[c] >= 100) {
      for (int i = 0; i < (100); ++i) {
        printf("%c", 'a' + c);
      }
      puts("");
      return 0;
    }
  memset(dp, (-1), sizeof(dp));
  K = 0;
  Print(0, len - 1);
  buff[K] = '\0';
  if (K < 100)
    puts(buff);
  else {
    for (int i = 0; i < (50); ++i) printf("%c", buff[i]);
    for (int j = 0; j < (50); ++j) printf("%c", buff[K - 50 + j]);
    puts("");
  }
  return 0;
}