#include <bits/stdc++.h>
using namespace std;
string txt , put;
int lps[1000100];
int kmp(){
int len = 0;
for(int i=0;i<txt.size();i++){
while(len > 0 && txt[i]!=put[len])
len=lps[len-1];
if(txt[i]==put[len])
++len;
if(i==(txt.size()-1)) return len;
}
}
void buildLps(){
int len = 0;
lps[0]=0;
for(int i=1;i<put.size();i++){
while(len > 0 && put[i]!=put[len])
len=lps[len-1];
if(put[i]==put[len])
++len;
lps[i]=len;
}
}
int main(){
while(cin>>txt){
put=txt;
reverse(put.begin(),put.end());
buildLps();
int need = kmp();
cout<<txt;
for(int i=need;i<put.size();i++) cout<<put[i];
cout<<endl;
}
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKc3RyaW5nIHR4dCAsIHB1dDsKaW50IGxwc1sxMDAwMTAwXTsKaW50IGttcCgpewogICAgaW50IGxlbiA9IDA7CiAgICBmb3IoaW50IGk9MDtpPHR4dC5zaXplKCk7aSsrKXsKICAgICAgICB3aGlsZShsZW4gPiAwICYmIHR4dFtpXSE9cHV0W2xlbl0pCiAgICAgICAgICAgIGxlbj1scHNbbGVuLTFdOwogICAgICAgIGlmKHR4dFtpXT09cHV0W2xlbl0pCiAgICAgICAgICAgICsrbGVuOwogICAgICAgIGlmKGk9PSh0eHQuc2l6ZSgpLTEpKSByZXR1cm4gbGVuOwogICAgfQp9CnZvaWQgYnVpbGRMcHMoKXsKICAgIGludCBsZW4gPSAwOwogICAgbHBzWzBdPTA7CiAgICBmb3IoaW50IGk9MTtpPHB1dC5zaXplKCk7aSsrKXsKICAgICAgICB3aGlsZShsZW4gPiAwICYmIHB1dFtpXSE9cHV0W2xlbl0pCiAgICAgICAgICAgIGxlbj1scHNbbGVuLTFdOwogICAgICAgIGlmKHB1dFtpXT09cHV0W2xlbl0pCiAgICAgICAgICAgICsrbGVuOwogICAgICAgIGxwc1tpXT1sZW47CiAgICB9Cn0KaW50IG1haW4oKXsKICAgIHdoaWxlKGNpbj4+dHh0KXsKICAgICAgICBwdXQ9dHh0OwogICAgICAgIHJldmVyc2UocHV0LmJlZ2luKCkscHV0LmVuZCgpKTsKICAgICAgICBidWlsZExwcygpOwogICAgICAgIGludCBuZWVkID0ga21wKCk7CiAgICAgICAgY291dDw8dHh0OwogICAgICAgIGZvcihpbnQgaT1uZWVkO2k8cHV0LnNpemUoKTtpKyspIGNvdXQ8PHB1dFtpXTsKICAgICAgICBjb3V0PDxlbmRsOwogICAgfQogICAgcmV0dXJuIDA7Cn0=