#include
#include
#include
#include
using namespace std;
void processString(string &input){
string result;
remove_copy_if(input.begin(), input.end(), back_inserter(result), ptr_fun(&ispunct));
for_each(result.begin(), result.end(), [](char &c){
c = ::toupper(c);
});
input = result;
}
void solve(string input){
processString(input);
int maxLength = 1;
int low, high, start = 0;
int len = input.length();
for(int i = 1; i < len; ++i){
low = i - 1;
high = i + 1;
while(input[low] == input[high] && low >= 0 && high < len){
if(high - low + 1 > maxLength){
start = low;
maxLength = high - low + 1;
}
--low;
++high;
}
low = i - 1;
high = i;
while(input[low] == input[high] && low >= 0 && high < len){
if(high - low + 1 > maxLength){
start = low;
maxLength = high - low + 1;
}
--low;
++high;
}
}
cout << input.substr(start, maxLength) << endl;
}
int main(){
string in;
while(cin >> in){
solve(in);
}
return 0;
}