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;
int dp[50010][110];
int N;
char str[50010];
vector<int> vp[200];
int prevPos(int element, int k) {
  int ret = lower_bound(vp[element].begin(), vp[element].end(), k) -
            vp[element].begin();
  ret--;
  return ret;
}
inline void ReadInput(void) { scanf("%s", str); }
inline void trace(int x, int y) {
  if (y == 0) return;
  printf("%c", str[x - 2]);
  if (y == 1) return;
  for (int i = 1; i <= x; i++) {
    if (dp[i][y - 2] and dp[i][y - 2] > dp[x][y]) {
      trace(i, y - 2);
      break;
    }
  }
  if (y != 1) printf("%c", str[x - 2]);
}
inline void solve(void) {
  N = strlen(str);
  for (int i = 0; i < N; i++) vp[str[i]].push_back(i + 1);
  for (int i = 1; i <= N + 1; i++) dp[i][1] = i - 1, dp[i][0] = i;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= 100; j++) {
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      int foo = prevPos(str[i - 1], dp[i][j]);
      if (foo >= 0)
        dp[i + 1][j + 2] = max(dp[i + 1][j + 2], vp[str[i - 1]][foo]);
    }
  }
  if (dp[N + 1][100]) {
    for (int i = 1; i <= N + 1; i++) {
      if (dp[i][100]) {
        trace(i, 100);
        return;
      }
    }
  } else {
    for (int j = 100; j >= 1; j--) {
      for (int i = 1; i <= N + 1; i++) {
        if (dp[i][j]) {
          trace(i, j);
          return;
        }
      }
    }
  }
}
inline void Refresh(void) {}
int main() {
  ReadInput();
  solve();
  return 0;
}