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