#include<stdio.h>
#include<algorithm>
#include<string.h>
using namespace std;
char A[2100];
char B[2100];
int dp[2100][2100];
int rev[2100][2100];
char ret[2100];
int main(){
	while(~scanf("%s",A)){
		int n=strlen(A);
		for(int i=0;i<n;i++)B[n-1-i]=A[i];
		for(int i=0;i<=n;i++)for(int j=0;j<=n;j++){
			dp[i][j]=-999999999;
			rev[i][j]=-1;
		}
		dp[0][0]=0;
		for(int i=0;i<=n;i++)for(int j=0;j<=n;j++){
			if(i<n&&j<n&&A[i]==B[j]&&dp[i+1][j+1]<dp[i][j]+1){
				dp[i+1][j+1]=dp[i][j]+1;
				rev[i+1][j+1]=2;
			}
			if(i<n&&dp[i+1][j]<dp[i][j]){
				dp[i+1][j]=dp[i][j];
				rev[i+1][j]=0;
			}
			if(j<n&&dp[i][j+1]<dp[i][j]){
				dp[i][j+1]=dp[i][j];
				rev[i][j+1]=1;
			}
		}
		ret[dp[n][n]]=0;
		int na=n;
		int nb=n;
		while(na||nb){
			if(rev[na][nb]==2){
				na--;nb--;
				ret[dp[na][nb]]=A[na];
			}else if(rev[na][nb]==1){
				nb--;
			}else{
				na--;
			}
		}
		printf("%s\n",ret);
	}
}