https://vjudge.net/problem/UVA-401
isalpha isdigit isprint 分别为判断 字母 数字 是否能打印
#include <iostream>
#include<cstring>
#include<string>
#include<cstdio>
using namespace std;
char mirror[]="A 3 HIL JM O 2TUVWXY51SE Z 8 ";//由于镜像表是按顺序排列的;
char mi(char x){
if(isalpha(x))return mirror[x-'A'];
return mirror[x-'0'+25];
}
int main()
{
char s[25];
while(cin>>s){
int p=1,m=1;
int len=strlen(s);
for(int i=0;i<len;i++){
if(s[i]!=s[len-i-1])p=0;
if(mi(s[i])!=s[len-i-1])m=0;
if(!p&&!m)break;
}
if(p&&m)cout<<s<<' '<<"-- is a mirrored palindrome.\n\n";
else if(p)cout<<s<<' '<<"-- is a regular palindrome.\n\n";
else if(m)cout<<s<<' '<<"-- is a mirrored string.\n\n";
else cout<<s<<' '<<"-- is not a palindrome.\n\n";
}
//cout << mirror[21] << endl;
return 0;
}