#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


int dp[2001][2001];
int memo[2001][2001];

int main(){

	int length;
	char buf[2001],reverse[2001];
	stack<char> ANS;

	while(scanf("%s",buf) != EOF){

		for(length = 0; buf[length] != '\0'; length++);

		for(int i = 0; i < length; i++){
			reverse[i] = buf[length-1-i];
		}
		reverse[length] = '\0';

		for(int i = 0; i <= length; i++){
			for(int k = 0; k <= length; k++){
				dp[i][k] = 0;
			}
		}

		for(int i = 0; i < length; i++){
			for(int k = 0; k < length; k++){
				if(buf[i] == reverse[k]){
					dp[i+1][k+1] = dp[i][k]+1;
					memo[i+1][k+1] = 0;
				}else{
					if(dp[i][k+1] >= dp[i+1][k]){
						dp[i+1][k+1] = dp[i][k+1];
						memo[i+1][k+1] = 1;
					}else{
						dp[i+1][k+1] = dp[i+1][k];
						memo[i+1][k+1] = -1;
					}
				}
			}
		}

		for(int i = length,k = length; i > 0 && k > 0;){

			if(memo[i][k] == 1){
				i--;
			}else if(memo[i][k] == -1){
				k--;
			}else{ //memo[i][k] == 0
				ANS.push(buf[i-1]);
				i--;
				k--;
			}
		}

		while(!ANS.empty()){
			printf("%c",ANS.top());
			ANS.pop();
		}

		printf("\n");
	}

	return 0;
}