#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),b=a*2;
tmp
=(char *)malloc(sizeof(char)*(a
+1));
if (tmp==NULL) {
}
for (int i=0;i<a;i++) {
tmp[i] = s[i];
}
for (int i=0;i<a;i++) {
tmp[a+i]=s[a-1-i];
}
tmp[b] = '\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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBteVN0cmxlbihjaGFyIHNbXSl7CiAgICBpbnQgaTsKICAgIGZvcihpPTA7c1tpXSE9J1wwJztpKyspOwogICAgcmV0dXJuIGk7Cn0KCmNoYXIgKnNldFBhbGluZHJvbWUoY2hhciBzW10pewoJY2hhciAqdG1wOwoJaW50IGE9bXlTdHJsZW4ocyksYj1hKjI7Cgl0bXA9KGNoYXIgKiltYWxsb2Moc2l6ZW9mKGNoYXIpKihhKzEpKTsKCmlmICh0bXA9PU5VTEwpIHsKICAgICAgICBwcmludGYoIuODoeODouODquOBrueiuuS/neOBq+WkseaVl+OBl+OBvuOBl+OBn1xuIik7CiAgICAgICAgZXhpdCgxKTsKICAgIH0KCiAgICBmb3IgKGludCBpPTA7aTxhO2krKykgewogICAgICAgIHRtcFtpXSA9IHNbaV07CiAgICB9CgogICAgZm9yIChpbnQgaT0wO2k8YTtpKyspIHsKICAgICAgICB0bXBbYStpXT1zW2EtMS1pXTsKICAgIH0KCiAgICB0bXBbYl0gPSAnXDAnOwogCiAgICByZXR1cm4gdG1wOwogICAgfQoKaW50IG1haW4oKXsKICAgIGludCBpOwogICAgY2hhciBueXVyeW9rdVsxMDI0XTsgCiAgICBjaGFyICprYWlidW47ICAgCiAgICBzY2FuZigiJXMiLG55dXJ5b2t1KTsKICAgIGthaWJ1biA9IHNldFBhbGluZHJvbWUobnl1cnlva3UpOwogICAgcHJpbnRmKCIlc1xuICAtPiAlc1xuIixueXVyeW9rdSxrYWlidW4pOwogICAgZnJlZShrYWlidW4pOwogICAgcmV0dXJuIDA7Cn0K