#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
string **dp;
int main() {
string s1,s2;
long long i,j;
cin>>s1;
s2=s1;
long long m=s1.size()+1;
reverse(s2.begin(),s2.end());
dp=new string* [m];
for(i=0;i<m;i++)dp[i]=new string [m];
for(i=1;i<m;i++){
for(j=1;j<m;j++){
if(s1[i-1]==s2[j-1])dp[i][j]=dp[i-1][j-1]+s2[j-1];
else{
if(dp[i-1][j].size()>dp[i][j-1].size())dp[i][j]=dp[i-1][j];
else dp[i][j]=dp[i][j-1];
}
}
}
cout<<dp[m-1][m-1];
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RyaW5nICoqZHA7CmludCBtYWluKCkgewoJc3RyaW5nIHMxLHMyOwoJbG9uZyBsb25nIGksajsKCWNpbj4+czE7CglzMj1zMTsKCWxvbmcgbG9uZyBtPXMxLnNpemUoKSsxOwoJcmV2ZXJzZShzMi5iZWdpbigpLHMyLmVuZCgpKTsKCWRwPW5ldyBzdHJpbmcqIFttXTsKCWZvcihpPTA7aTxtO2krKylkcFtpXT1uZXcgc3RyaW5nIFttXTsKCWZvcihpPTE7aTxtO2krKyl7CgkJZm9yKGo9MTtqPG07aisrKXsKCQkJaWYoczFbaS0xXT09czJbai0xXSlkcFtpXVtqXT1kcFtpLTFdW2otMV0rczJbai0xXTsKCQkJZWxzZXsKCQkJCWlmKGRwW2ktMV1bal0uc2l6ZSgpPmRwW2ldW2otMV0uc2l6ZSgpKWRwW2ldW2pdPWRwW2ktMV1bal07CgkJCQllbHNlIGRwW2ldW2pdPWRwW2ldW2otMV07CgkJCX0KCQl9Cgl9Cgljb3V0PDxkcFttLTFdW20tMV07CglyZXR1cm4gMDsKfQ==