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