#include<bits/stdc++.h>
#define N 2000005
using namespace std ;
string original ;
string rev ;
string medium ;
vector <int> vec (N,0) ;
using namespace std;
void z_function(){
int left = 0 ;
int right = 0 ;
int n = medium.size() ;
for (int i = 1; i < n; i++){
if (i <= right)
vec[i] = min(right - i + 1, vec[i - left]) ;
while (i + vec[i] < n && medium[vec[i]] == medium[i + vec[i]])
vec[i]++ ;
if (i + vec[i] -1 > right){
right = i + vec[i] - 1 ;
left = i ;
}
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0) ;
while(!cin.eof()){
cin >> rev ;
original = rev;
reverse(rev.begin(), rev.end()) ;
if (original == rev){
cout << original << "\n" ;
continue;
}
medium = rev + original ;
z_function() ;
int n = original.size() ;
int m = 2 * n ;
for(int i = n; i < m; i++)
if (m - i == vec[i]){
cout << original ;
for (int j = n - vec[i] - 1; j >= 0; j--)
cout << original[j] ;
break;
}
cout << "\n" ;
for (int i = 0; i <= m; i++)
vec[i] = 0 ;
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBOIDIwMDAwMDUKdXNpbmcgbmFtZXNwYWNlIHN0ZAkJOwpzdHJpbmcgb3JpZ2luYWwgOwpzdHJpbmcgcmV2ICA7CnN0cmluZyBtZWRpdW0gICA7CnZlY3RvciA8aW50PiB2ZWMgKE4sMCkgICAgOwoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKdm9pZCB6X2Z1bmN0aW9uKCl7CiAgICBpbnQgbGVmdCAgPSAwICAgOwogICAgaW50IHJpZ2h0ID0gMCAgIDsKICAgIGludCBuID0gbWVkaXVtLnNpemUoKSAgICA7CiAgICBmb3IgKGludCBpID0gMTsgaSA8IG47IGkrKyl7CgogICAgICAgIGlmIChpIDw9IHJpZ2h0KQogICAgICAgICAgICB2ZWNbaV0gPSBtaW4ocmlnaHQgLSBpICsgMSwgdmVjW2kgLSBsZWZ0XSkgOwoKICAgICAgICB3aGlsZSAoaSArIHZlY1tpXSA8IG4gICYmIG1lZGl1bVt2ZWNbaV1dID09IG1lZGl1bVtpICsgdmVjW2ldXSkKICAgICAgICAgICAgdmVjW2ldKysgICAgOwoKICAgICAgICBpZiAoaSArIHZlY1tpXSAtMSA+IHJpZ2h0KXsKICAgICAgICAgICAgcmlnaHQgPSBpICsgdmVjW2ldIC0gMSAgOwogICAgICAgICAgICBsZWZ0ID0gaSAgICA7CiAgICAgICAgfQogICAgfQp9CmludCBtYWluKCl7CiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOyAgIGNpbi50aWUoMCkgIDsKICAgIHdoaWxlKCFjaW4uZW9mKCkpewogICAgICAgICAgICBjaW4gPj4gcmV2IDsKICAgICAgICAgICAgb3JpZ2luYWwgPSByZXY7CiAgICAgICAgICAgIHJldmVyc2UocmV2LmJlZ2luKCksIHJldi5lbmQoKSkgICA7CiAgICAgICAgICAgIGlmIChvcmlnaW5hbCA9PSByZXYpewogICAgICAgICAgICAJY291dCA8PCBvcmlnaW5hbCA8PCAiXG4iCTsKICAgICAgICAgICAgCWNvbnRpbnVlOwogICAgICAgICAgICB9CiAgICAgICAgICAgIG1lZGl1bSA9IHJldiArIG9yaWdpbmFsIDsKICAgICAgICAgICAgel9mdW5jdGlvbigpICAgOwogICAgICAgICAgICBpbnQgbiA9IG9yaWdpbmFsLnNpemUoKQk7CiAgICAgICAgICAgIGludCBtID0gMiAqIG4JOwogICAgICAgICAgIGZvcihpbnQgaSA9IG47IGkgPCBtOyBpKyspCiAgICAgICAgICAgCQlpZiAobSAtIGkgPT0gdmVjW2ldKXsKICAgICAgICAgICAgICAgICAgICAgICAgY291dCA8PCBvcmlnaW5hbCAgICA7CiAgICAgICAgICAgCQkJZm9yIChpbnQgaiAgPSBuIC0gdmVjW2ldIC0gMTsgaiA+PSAwOyBqLS0pCiAgICAgICAgICAgCQkJCWNvdXQgPDwgb3JpZ2luYWxbal0gOwogICAgICAgICAgICAgICAgICAgIGJyZWFrOwoKICAgICAgICAgICAJCX0KICAgICAgICAgICAgY291dCA8PCAiXG4iICAgIDsKICAgICAgICAgICAgZm9yIChpbnQgaSA9IDA7IGkgPD0gbTsgaSsrKQogICAgICAgICAgICAgICAgdmVjW2ldID0gMCAgOwogICAgfQogICAgcmV0dXJuICAwOwp9Cg==