#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    
    string payload;
    cin>>payload;
    
    int N = payload.size();
    int im, mlen = 0, mcp = 0, diff = -1;
    int C = 1, R = 2, i = 0; 
    N = 2*N + 1; 
    int L[N];
    L[0] = 0; L[1] = 1;

    for (i = 2; i < N; i++){

        im  = 2*C-i;
        L[i] = 0;
        diff = R - i;

        if(diff > 0)
            L[i] = min(L[im], diff);
 
        while ( ((i + L[i]) < N && (i - L[i]) > 0) && ( ((i + L[i] + 1) % 2 == 0) || (payload[(i + L[i] + 1)/2] == payload[(i - L[i] - 1)/2] ))){
            L[i]++;
        }
 
        if(L[i] > mlen)
        {
            mlen = L[i];
            mcp = i;
        }
 
        if (i + L[i] > R) 
        {
            C = i;
            R = i + L[i];
        }
    }

    for(i= (mcp - mlen)/2; i<= (mcp - mlen)/2 + mlen - 1; i++){
        cout<<payload[i];
    }
        
    cout<<endl;

    return 0;
}