#include <bits/stdc++.h>

using namespace std;

ifstream fi ("bai5a.inp");
ofstream fo ("bai5a.out");

bool testdx(string s){
  int i , n = s.length() , test=1;
  for ( i = 0 ; i < n/2 ; i++ ){
    if (s[i]!=s[n-1-i]){test=0;}
  }
  if (test==1){return true;}
  else {return false;}
}

int main(){
  string s,test;
  std::getline(fi,s);

  int i,k,a[256] = {0},n=s.length(),num=0,num1=0,vt,vt1,vt2;
  num=1;
  for (i=0;i<n;i++){test="";
    test=test+s[i];vt1=i;
    for (k=i+1;k<n;k++){
        test=test+s[k];
        if (s[k]==s[i]){
          if (testdx(test)==true){num1=test.length();}
        }
        if (num<num1){num=num1;vt2=k;vt=vt1;}
    }
  }
  for (i=vt;i<=vt2;i++){fo<<s[i];}
  }
}
