#include <bits/stdc++.h>
using namespace std;
string s;
int n,m,b[10000][10000],a[10000][10000],m1,vitri1,vitri2,n1,gtln=INT_MIN;
bool check(string s,int m,int n)
{
    for (int i=0;i*2<=n-m;i++)
    {
        if (s[m+i]!=s[n-i])
            return false;
    }
    return true;
}
int main()
{
    freopen("bai5a.inp","r",stdin);
    freopen("bai5a.out","w",stdout);
    getline(cin,s);
    if (check(s,m1,s.size()-1))
    {
        cout<<s;
    }
    else
    {for (int i=0;i<s.size();i++)
    {
        for (int j=i;j<s.size();j++)
        {
            if (check(s,i,j)==true)
            {
                if (j-i+1>gtln)
                {
                    gtln=j-i+1;
                    vitri1=i;
                    vitri2=j;
                }
            }
        }
    }
    for (int i=vitri1;i<=vitri2;i++)
    {
        cout<<s[i];
    }
    }
}

