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