#include <stdio.h>
#include <stdio.h>
int myStrlen(char s[]){
int i;
for(i=0;s[i]!='\0';i++);
return i;
}
char *setPalindrome(char s[]){
int len=myStrlen(s);
char *tmp
=(char *)malloc((2 * len
+1) * sizeof(char)); if(tmp==NULL){
return NULL;
}
for(int i=0;i<len;i++){
tmp[i]=s[i];
}
for(int i=0;i<len;i++){
tmp[len+i]=s[len-i-1];
}
tmp[2*len]='\0';
return tmp;
}
int main(void) {
// your code goes here
char nyuryoku[1024];
char *kaibun;
kaibun=setPalindrome(nyuryoku);
if(kaibun!=NULL){
printf("%s\n -> %s\n", nyuryoku
, kaibun
); }
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRpby5oPgoKaW50IG15U3RybGVuKGNoYXIgc1tdKXsKCWludCBpOwoJZm9yKGk9MDtzW2ldIT0nXDAnO2krKyk7CglyZXR1cm4gaTsKfQoKY2hhciAqc2V0UGFsaW5kcm9tZShjaGFyIHNbXSl7CglpbnQgbGVuPW15U3RybGVuKHMpOwoJCgljaGFyICp0bXA9KGNoYXIgKiltYWxsb2MoKDIgKiBsZW4rMSkgKiBzaXplb2YoY2hhcikpOwoJaWYodG1wPT1OVUxMKXsKCQlyZXR1cm4gTlVMTDsKCX0KCQoJZm9yKGludCBpPTA7aTxsZW47aSsrKXsKCQl0bXBbaV09c1tpXTsKCX0KCQoJZm9yKGludCBpPTA7aTxsZW47aSsrKXsKCQl0bXBbbGVuK2ldPXNbbGVuLWktMV07Cgl9CgkKCXRtcFsyKmxlbl09J1wwJzsKCQoJcmV0dXJuIHRtcDsKfQoKaW50IG1haW4odm9pZCkgewoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJY2hhciBueXVyeW9rdVsxMDI0XTsKCWNoYXIgKmthaWJ1bjsKCXNjYW5mKCIlcyIsIG55dXJ5b2t1KTsKCQoJa2FpYnVuPXNldFBhbGluZHJvbWUobnl1cnlva3UpOwoJaWYoa2FpYnVuIT1OVUxMKXsKCQlwcmludGYoIiVzXG4gIC0+ICVzXG4iLCBueXVyeW9rdSwga2FpYnVuKTsKCQlmcmVlKGthaWJ1bik7Cgl9CglyZXR1cm4gMDsKfQo=