#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+1;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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBteVN0cmxlbihjaGFyIHNbXSl7CiAgICBpbnQgaTsKICAgIGZvcihpPTA7c1tpXSE9J1wwJztpKyspOwogICAgcmV0dXJuIGk7Cn0KCgpjaGFyICpzZXRQYWxpbmRyb21lKGNoYXIgc1tdKXsKCWNoYXIgKnRtcDsKICAgIGludCBrLHEscDsKICAgIGZvcihrPTA7c1trKzFdIT0nXDAnO2srKyk7Cgl0bXA9KGNoYXIqKW1hbGxvYyhzaXplb2YoY2hhcikqayoyKTsKZm9yKHE9MDtxPGs7cSsrKXsgICAgCnRtcFtxXT1zW3FdOwp9CmZvcihwPXE7cDwyKmsrMTtwKyspewp0bXBbcF09c1syKmstcF07Cn0KdG1wW3ArMV09J1wwJzsKcmV0dXJuIHRtcDsKfQoKaW50IG1haW4oKXsKICAgIGludCBpOwogICAgY2hhciBueXVyeW9rdVsxMDI0XTsgCiAgICBjaGFyICprYWlidW47ICAgCiAgICBzY2FuZigiJXMiLG55dXJ5b2t1KTsKICAgIGthaWJ1biA9IHNldFBhbGluZHJvbWUobnl1cnlva3UpOwogICAgcHJpbnRmKCIlc1xuICAtPiAlc1xuIixueXVyeW9rdSxrYWlidW4pOwogICAgZnJlZShrYWlidW4pOwogICAgcmV0dXJuIDA7Cn0K