#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[]) {
int len = myStrlen(s);
char *tmp
= (char *)malloc(len
+ 1);
if (tmp == NULL) {
}
for (int i = 0; i < len; i++) {
tmp[i] = s[len - 1 - i];
}
tmp[len] = '\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+CiNpbmNsdWRlIDxzdGRsaWIuaD4KCmludCBteVN0cmxlbihjaGFyIHNbXSkgewogICAgaW50IGk7CiAgICBmb3IgKGkgPSAwOyBzW2ldICE9ICdcMCc7IGkrKyk7CiAgICByZXR1cm4gaTsKfQoKY2hhciAqc2V0UGFsaW5kcm9tZShjaGFyIHNbXSkgewogICAgaW50IGxlbiA9IG15U3RybGVuKHMpOwogICAgY2hhciAqdG1wID0gKGNoYXIgKiltYWxsb2MobGVuICsgMSk7CgogICAgaWYgKHRtcCA9PSBOVUxMKSB7CiAgICAgICAgcHJpbnRmKCLjg6Hjg6Ljg6rjga7norrkv53jgavlpLHmlZfjgZfjgb7jgZfjgZ9cbiIpOwogICAgICAgIGV4aXQoMSk7CiAgICB9CgogICAgZm9yIChpbnQgaSA9IDA7IGkgPCBsZW47IGkrKykgewogICAgICAgIHRtcFtpXSA9IHNbbGVuIC0gMSAtIGldOwogICAgfQogICAgdG1wW2xlbl0gPSAnXDAnOwoKICAgIHJldHVybiB0bXA7Cn0KCmludCBtYWluKCkgewogICAgaW50IGk7CiAgICBjaGFyIG55dXJ5b2t1WzEwMjRdOwogICAgY2hhciAqa2FpYnVuOwoKICAgIHNjYW5mKCIlcyIsIG55dXJ5b2t1KTsKICAgIGthaWJ1biA9IHNldFBhbGluZHJvbWUobnl1cnlva3UpOwogICAgcHJpbnRmKCIlc1xuICAtPiAlc1xuIiwgbnl1cnlva3UsIGthaWJ1bik7CgogICAgZnJlZShrYWlidW4pOwogICAgcmV0dXJuIDA7Cn0K