#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 x,y,i,j;
j=1;
x=myStrlen(s);
tmp
=(char*)malloc(sizeof(char)*(2*x
)+1); for(i=0;i<2*x;i++){
if(i<x){
tmp[i]=s[i];
}
else{
tmp[i]=s[i-j];
j=j+2;
}
}
return tmp;
}
int main(){
int i;
char nyuryoku[1024];
char *kaibun;
kaibun = setPalindrome(nyuryoku);
printf("%s\n -> %s\n",nyuryoku
,kaibun
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBteVN0cmxlbihjaGFyIHNbXSl7CiAgICBpbnQgaTsKICAgIGZvcihpPTA7c1tpXSE9J1wwJztpKyspOwogICAgcmV0dXJuIGk7Cn0KCmNoYXIgKnNldFBhbGluZHJvbWUoY2hhciBzW10pewoJY2hhciAqdG1wOwoJaW50IHgseSxpLGo7CglqPTE7Cgl4PW15U3RybGVuKHMpOwoJdG1wPShjaGFyKiltYWxsb2Moc2l6ZW9mKGNoYXIpKigyKngpKzEpOwoJZm9yKGk9MDtpPDIqeDtpKyspewoJCWlmKGk8eCl7CgkJCXRtcFtpXT1zW2ldOwoJCX0KCQllbHNlewoJCQl0bXBbaV09c1tpLWpdOwoJCQlqPWorMjsKCQl9Cgl9CglyZXR1cm4gdG1wOwp9CgoKaW50IG1haW4oKXsKICAgIGludCBpOwogICAgY2hhciBueXVyeW9rdVsxMDI0XTsKICAgIGNoYXIgKmthaWJ1bjsgICAKICAgIHNjYW5mKCIlcyIsbnl1cnlva3UpOwogICAga2FpYnVuID0gc2V0UGFsaW5kcm9tZShueXVyeW9rdSk7CiAgICBwcmludGYoIiVzXG4gIC0+ICVzXG4iLG55dXJ5b2t1LGthaWJ1bik7CiAgICBmcmVlKGthaWJ1bik7CiAgICByZXR1cm4gMDsKfQo=