#include <stdio.h>
#include <stdlib.h>
//プログラミング及び演習4_第2回_提出課題2
int myStrlen(char s[]){
int i;
for(i=0;s[i]!='\0';i++);
return i;
}
char *setPalindrome(char s[]){
int i;
int mojisuu=myStrlen(s);
char *tmp;
tmp
=(char*)malloc(mojisuu
*2+1); for(i=0;i<mojisuu;i++){
tmp[i]=s[i];
}
for(i=0;i<mojisuu;i++){
tmp[mojisuu+i]=tmp[(mojisuu-1)-i];
}
return tmp;
}
int main(){
char nyuryoku[1024];
char *kaibun;
kaibun = setPalindrome(nyuryoku);
printf("%s\n -> %s\n",nyuryoku
,kaibun
); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KLy/jg5fjg63jgrDjg6njg5/jg7PjgrDlj4rjgbPmvJTnv5I0X+esrDLlm55f5o+Q5Ye66Kqy6aGMMgppbnQgbXlTdHJsZW4oY2hhciBzW10pewogICAgaW50IGk7CiAgICBmb3IoaT0wO3NbaV0hPSdcMCc7aSsrKTsKICAgIHJldHVybiBpOwp9CgpjaGFyICpzZXRQYWxpbmRyb21lKGNoYXIgc1tdKXsKCWludCBpOwoJaW50IG1vamlzdXU9bXlTdHJsZW4ocyk7CgljaGFyICp0bXA7CiAgICB0bXA9KGNoYXIqKW1hbGxvYyhtb2ppc3V1KjIrMSk7CiAgICBmb3IoaT0wO2k8bW9qaXN1dTtpKyspewogICAgCXRtcFtpXT1zW2ldOwogICAgfQogICAgZm9yKGk9MDtpPG1vamlzdXU7aSsrKXsKICAgIAl0bXBbbW9qaXN1dStpXT10bXBbKG1vamlzdXUtMSktaV07CiAgICB9CiAgICByZXR1cm4gdG1wOwp9CgppbnQgbWFpbigpewogICAgY2hhciBueXVyeW9rdVsxMDI0XTsKICAgIGNoYXIgKmthaWJ1bjsKICAgIHNjYW5mKCIlcyIsbnl1cnlva3UpOwogICAga2FpYnVuID0gc2V0UGFsaW5kcm9tZShueXVyeW9rdSk7CiAgICBwcmludGYoIiVzXG4gIC0+ICVzXG4iLG55dXJ5b2t1LGthaWJ1bik7CiAgICBmcmVlKGthaWJ1bik7CiAgICByZXR1cm4gMDsKfQo=