#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

const int N = 2000;

int dp[N+1][N+1];
int p[N+1][N+1];


string lcs(string a, string b){
  int size = (int)a.size();
  //vector< vector<int> > dp(size+1, vector<int>(size+1));
  //vector< vector<int> > p(size+1, vector<int>(size+1));
  fill(dp[0], dp[N+1], 0);
  fill(p[0], p[N+1], 0);
  for(int i=0;i<size;++i){
    for(int j=0;j<size;++j){
      if(a[i] == b[j]){
	dp[i+1][j+1] = dp[i][j] + 1;
	p[i+1][j+1] = 0;
      }else if(dp[i+1][j] < dp[i][j+1]){
	dp[i+1][j+1] = dp[i][j+1];
	p[i+1][j+1] = 1;
      }else{
	dp[i+1][j+1] = dp[i+1][j];
	p[i+1][j+1] = -1;
      }
    }
  }
  string res;
  for(int i=size, j=size;i>0 && j>0;){
    if(p[i][j] > 0) --i;
    else if(p[i][j] < 0) --j;
    else{
      res += a[i-1];
      --i;
      --j;
    }
  }
  reverse(res.begin(), res.end());
  return res;
}

int main(){
  string input;
  while(cin >> input){
    string tmp = input;
    reverse(tmp.begin(), tmp.end());
    cout << lcs(input, tmp) << endl;
  }
  return 0;
}