#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 j=myStrlen(s);
tmp
=(char*)malloc(sizeof(char)*(2*j
+1)); for(int k=0;k<j;k++){
tmp[k]=s[k];
}
for(int k=0;k<j;k++){
tmp[j+k]=s[j-k-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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KIAppbnQgbXlTdHJsZW4oY2hhciBzW10pewogICAgaW50IGk7CiAgICBmb3IoaT0wO3NbaV0hPSdcMCc7aSsrKTsKICAgIHJldHVybiBpOwp9CiAKCmNoYXIgKnNldFBhbGluZHJvbWUoY2hhciBzW10pewoJY2hhciAqdG1wOwoJaW50IGo9bXlTdHJsZW4ocyk7Cgl0bXA9KGNoYXIqKW1hbGxvYyhzaXplb2YoY2hhcikqKDIqaisxKSk7Cglmb3IoaW50IGs9MDtrPGo7aysrKXsKCQl0bXBba109c1trXTsKCX0KCWZvcihpbnQgaz0wO2s8ajtrKyspewoJCXRtcFtqK2tdPXNbai1rLTFdOwoJfQoJcmV0dXJuIHRtcDsKfQogCiAKCmludCBtYWluKCl7CiAgICBpbnQgaTsKICAgIGNoYXIgbnl1cnlva3VbMTAyNF07IAogICAgY2hhciAqa2FpYnVuOyAgIAogICAgc2NhbmYoIiVzIixueXVyeW9rdSk7CiAgICBrYWlidW4gPSBzZXRQYWxpbmRyb21lKG55dXJ5b2t1KTsKICAgIHByaW50ZigiJXNcbiAgLT4gJXNcbiIsbnl1cnlva3Usa2FpYnVuKTsKICAgIGZyZWUoa2FpYnVuKTsKICAgIHJldHVybiAwOwp9