#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *setPalindrome(char s[]){
int length
= strlen(s
); //文字列の長さの取得 char *pal
= (char*)malloc(sizeof(char) * (2 * length
));
if(pal == NULL)return NULL;
strcpy(pal
, s
); //文字列のコピー(s -> pal)
for(int i=0; i < length - 1; i++){
*(pal + length + i) = s[length - 2 - i];
}
*(pal + 2 * length - 1) = '\0';
return pal;
}
int main(void){
char enter[1024];
char *result = setPalindrome(enter);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRsaWIuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgoKY2hhciAqc2V0UGFsaW5kcm9tZShjaGFyIHNbXSl7CiAgICBpbnQgbGVuZ3RoID0gc3RybGVuKHMpOyAvL+aWh+Wtl+WIl+OBrumVt+OBleOBruWPluW+lwogICAgY2hhciAqcGFsID0gKGNoYXIqKW1hbGxvYyhzaXplb2YoY2hhcikgKiAoMiAqIGxlbmd0aCkpOwoKICAgIGlmKHBhbCA9PSBOVUxMKXJldHVybiBOVUxMOwoKICAgIHN0cmNweShwYWwsIHMpOyAvL+aWh+Wtl+WIl+OBruOCs+ODlOODvChzIC0+IHBhbCkKCiAgICBmb3IoaW50IGk9MDsgaSA8IGxlbmd0aCAtIDE7IGkrKyl7CiAgICAgICAgKihwYWwgKyBsZW5ndGggKyBpKSA9IHNbbGVuZ3RoIC0gMiAtIGldOwogICAgfQogICAgKihwYWwgKyAyICogbGVuZ3RoIC0gMSkgPSAnXDAnOwoKICAgIHJldHVybiBwYWw7Cn0KaW50IG1haW4odm9pZCl7CiAgICBjaGFyIGVudGVyWzEwMjRdOwogICAgc2NhbmYoIiVzIiwgZW50ZXIpOwogICAgY2hhciAqcmVzdWx0ID0gc2V0UGFsaW5kcm9tZShlbnRlcik7CiAgICBwcmludGYoIiVzIiwgcmVzdWx0KTsKICAgIGZyZWUocmVzdWx0KTsKICAgIHJldHVybiAwOwp9