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.
#include <bits/stdc++.h>
using namespace std;
char s[50005];
int dp[50005][105];
int lastEach[26][50005];
char used[50005][105];
bool mark[50005][105];
void print(int r, int left) {
  if (left < 1) return;
  if (left == 1) {
    printf("%c", used[r][1]);
    return;
  }
  if (left == 2) {
    printf("%c%c", used[r][left], used[r][left]);
    return;
  }
  if (mark[r][left])
    print(r - 1, left);
  else {
    printf("%c", used[r][left]);
    print(r - 1, left - 2);
    printf("%c", used[r][left]);
  }
}
int main() {
  scanf("%s", s);
  int len = strlen(s);
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < 50005; j++) lastEach[i][j] = -1;
  lastEach[s[0] - 'a'][0] = 0;
  for (int i = 1; i < len; i++) {
    for (int j = 0; j < 26; j++) lastEach[j][i] = lastEach[j][i - 1];
    lastEach[s[i] - 'a'][i] = i;
  }
  for (int i = 0; i < 105; i++)
    for (int j = 0; j < 50005; j++) dp[j][i] = -1;
  dp[0][1] = 0;
  used[0][1] = s[0];
  for (int i = 1; i < len; i++) {
    dp[i][1] = i;
    used[i][1] = s[i];
    for (int j = 2; j < 105; j++) {
      dp[i][j] = dp[i - 1][j];
      used[i][j] = used[i - 1][j];
      mark[i][j] = true;
    }
    if (lastEach[s[i] - 'a'][i - 1] > dp[i - 1][2]) {
      dp[i][2] = lastEach[s[i] - 'a'][i - 1];
      used[i][2] = s[i];
    }
    for (int j = 3; j < 105; j++) {
      if (dp[i - 1][j - 2] > 0 &&
          lastEach[s[i] - 'a'][dp[i - 1][j - 2] - 1] != -1) {
        if (dp[i][j] < lastEach[s[i] - 'a'][dp[i - 1][j - 2] - 1]) {
          dp[i][j] = lastEach[s[i] - 'a'][dp[i - 1][j - 2] - 1];
          used[i][j] = s[i];
          mark[i][j] = false;
        }
      }
    }
  }
  int maxx = 0;
  for (int i = 100; i >= 0; i--) {
    if (dp[len - 1][i] != -1) {
      print(len - 1, i);
      break;
    }
  }
  return 0;
}
