#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string Manacher(string s){
int n = (int)(s.size());
vector<int> d1(n);
for (int i = 0, l = 0, r = -1; i < n; i++) {
int k = (i > r) ? 1 : min(d1[l + r - i], r - i + 1);
while (0 <= i - k && i + k < n && s[i - k] == s[i + k]) {
k++;
}
d1[i] = k--;
if (i + k > r) {
l = i - k;
r = i + k;
}
}
vector<int> d2(n);
for (int i = 0, l = 0, r = -1; i < n; i++) {
int k = (i > r) ? 0 : min(d2[l + r - i + 1], r - i + 1);
while (0 <= i - k - 1 && i + k < n && s[i - k - 1] == s[i + k]) {
k++;
}
d2[i] = k--;
if (i + k > r) {
l = i - k - 1;
r = i + k ;
}
}
int maxLen = 1;
for(int i = 0; i < n; i++){
if(d1[i] == i+1)
maxLen = max(maxLen, 2*i+1);
if(d2[i] == i)
maxLen = max(maxLen, 2*i);
}
return s.substr(0,maxLen);
}
int main() {
string s;
cin >> s;
cout << Manacher(s);
return 0;
}
I2luY2x1ZGUgPGNtYXRoPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxhbGdvcml0aG0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgoKc3RyaW5nIE1hbmFjaGVyKHN0cmluZyBzKXsKICAgIGludCBuID0gKGludCkocy5zaXplKCkpOwoKICAgIHZlY3RvcjxpbnQ+IGQxKG4pOwogICAgZm9yIChpbnQgaSA9IDAsIGwgPSAwLCByID0gLTE7IGkgPCBuOyBpKyspIHsKICAgICAgICBpbnQgayA9IChpID4gcikgPyAxIDogbWluKGQxW2wgKyByIC0gaV0sIHIgLSBpICsgMSk7CiAgICAgICAgd2hpbGUgKDAgPD0gaSAtIGsgJiYgaSArIGsgPCBuICYmIHNbaSAtIGtdID09IHNbaSArIGtdKSB7CiAgICAgICAgICAgIGsrKzsKICAgICAgICB9CiAgICAgICAgZDFbaV0gPSBrLS07CiAgICAgICAgaWYgKGkgKyBrID4gcikgewogICAgICAgICAgICBsID0gaSAtIGs7CiAgICAgICAgICAgIHIgPSBpICsgazsKICAgICAgICB9CiAgICB9CgogICAgdmVjdG9yPGludD4gZDIobik7CiAgICBmb3IgKGludCBpID0gMCwgbCA9IDAsIHIgPSAtMTsgaSA8IG47IGkrKykgewogICAgICAgIGludCBrID0gKGkgPiByKSA/IDAgOiBtaW4oZDJbbCArIHIgLSBpICsgMV0sIHIgLSBpICsgMSk7CiAgICAgICAgd2hpbGUgKDAgPD0gaSAtIGsgLSAxICYmIGkgKyBrIDwgbiAmJiBzW2kgLSBrIC0gMV0gPT0gc1tpICsga10pIHsKICAgICAgICAgICAgaysrOwogICAgICAgIH0KICAgICAgICBkMltpXSA9IGstLTsKICAgICAgICBpZiAoaSArIGsgPiByKSB7CiAgICAgICAgICAgIGwgPSBpIC0gayAtIDE7CiAgICAgICAgICAgIHIgPSBpICsgayA7CiAgICAgICAgfQogICAgfQoKICAgIGludCBtYXhMZW4gPSAxOwogICAgZm9yKGludCBpID0gMDsgaSA8IG47IGkrKyl7CiAgICAgICAgaWYoZDFbaV0gPT0gaSsxKQogICAgICAgICAgICBtYXhMZW4gPSBtYXgobWF4TGVuLCAyKmkrMSk7CiAgICAgICAgaWYoZDJbaV0gPT0gaSkKICAgICAgICAgICAgbWF4TGVuID0gbWF4KG1heExlbiwgMippKTsKICAgIH0KICAgIHJldHVybiBzLnN1YnN0cigwLG1heExlbik7Cn0KCgppbnQgbWFpbigpIHsKICAgIHN0cmluZyBzOwogICAgY2luID4+IHM7CiAgICBjb3V0IDw8IE1hbmFjaGVyKHMpOwogICAgcmV0dXJuIDA7Cn0=