#include #include char s[25]; char m[25]; char rev(char x) { if(x == 'E') return '3'; if(x == 'J') return 'L'; if(x == 'L') return 'J'; if(x == 'S') return '2'; if(x == 'Z') return '5'; if(x == '2') return 'S'; if(x == '3') return 'E'; if(x == '5') return 'Z'; return x; } void makerev(void) { char *p, *q; p = s; q = m; while(*p) { *q = rev(*p); q++, p++; } *q = *p; } int cmprev(char *p, char *q) { while(*q) q++; q--; while(*p) { if(*p != *q) return 0; p++; q--; } return 1; } int main(void) { int mir, pal; while(1) { s[0] = '\0'; gets(s); if(strlen(s) == 0) return 0; makerev(); mir = cmprev(s, m); pal = cmprev(s,s); printf("%s",s); if(mir && pal) printf(" -- is a mirrored palindrome.\n"); else if(mir) printf(" -- is a mirrored string.\n"); else if(pal) printf(" -- is a regular palindrome.\n"); else printf(" -- is not a palindrome.\n"); } }