#include <stdio.h>
#include <stdlib.h>
int myStrlen(char s[]){
int i;
for(i=0;s[i]!='\0';i++);
return i;
}
char *setPalindrome(char s[]){
char *tmp;
int len=myStrlen(s);
tmp
=(char *)malloc(sizeof(char )*len
+1);if(tmp==NULL){
return 0;
}
for(int i=0;i<len;i++){
tmp[i]=s[i];
}
for(int i=0;i<len;i++){
tmp[len+i]=tmp[len-1-i];
}
return tmp;
}
int main(){
int i;
char nyuryoku[1024]; //入力
char *kaibun; //回文を受け取る
kaibun = setPalindrome(nyuryoku);
printf("%s\n -> %s\n",nyuryoku
,kaibun
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBteVN0cmxlbihjaGFyIHNbXSl7CiAgICBpbnQgaTsKICAgIGZvcihpPTA7c1tpXSE9J1wwJztpKyspOwogICAgcmV0dXJuIGk7Cn0KCmNoYXIgKnNldFBhbGluZHJvbWUoY2hhciBzW10pewoJY2hhciAqdG1wOwppbnQgbGVuPW15U3RybGVuKHMpOwp0bXA9KGNoYXIgKiltYWxsb2Moc2l6ZW9mKGNoYXIgKSpsZW4rMSk7CmlmKHRtcD09TlVMTCl7CglwcmludGYoIkVSUk9UUiIpOwoJcmV0dXJuIDA7Cn0KZm9yKGludCBpPTA7aTxsZW47aSsrKXsKdG1wW2ldPXNbaV07Cn0KCmZvcihpbnQgaT0wO2k8bGVuO2krKyl7CgkJdG1wW2xlbitpXT10bXBbbGVuLTEtaV07Cgl9CglyZXR1cm4gdG1wOwp9CgoKaW50IG1haW4oKXsKICAgIGludCBpOwogICAgY2hhciBueXVyeW9rdVsxMDI0XTsgLy/lhaXlipsKICAgIGNoYXIgKmthaWJ1bjsgICAvL+WbnuaWh+OCkuWPl+OBkeWPluOCiwogICAgc2NhbmYoIiVzIixueXVyeW9rdSk7CiAgICBrYWlidW4gPSBzZXRQYWxpbmRyb21lKG55dXJ5b2t1KTsKICAgIHByaW50ZigiJXNcbiAgLT4gJXNcbiIsbnl1cnlva3Usa2FpYnVuKTsKICAgIGZyZWUoa2FpYnVuKTsKICAgIHJldHVybiAwOwp9Cg==