///////////////////////////////////////////////////////////////////////////////////////////////////////
作者:tt2767
声明:本文遵循以下协议自由转载-非商用-非衍生-保持署名|Creative Commons BY-NC-ND 3.0
查看本文更新与讨论请点击:http://blog.youkuaiyun.com/tt2767
链接被删请百度: 优快云 tt2767
///////////////////////////////////////////////////////////////////////////////////////////////////////
原来一直都是一个一个switch来着,这回方便了。。。
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
//////////////////////
#include<iostream>
#include<algorithm>
#include<string>
#include <iterator>
#include<sstream>
#include<functional>
#include<numeric>
///////////////////////
#include<vector>
#include<map>
#include <stack>
#include<queue>
#include<set>
#include <bitset>
#include <list>
using namespace std;
#define lch(x) ((x) << 1)
#define rch(x) ((x)<<1|1)
#define dad(x) ((x)>>1)
#define lowbit(x) ((x)&(-x))
typedef long long int LL;
const int INF = ~0U>>1;
const double eps = 1e-6;
const long double PI = acos(0.0) * 2.0;
const int N = 10 + 30000;
char a[N];
char s[N]="ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";
char h[N]="A 3 HIL JM O 2TUVWXY51SE Z 8 ";
char mp[N]={0};
bool p(char * x);
bool m(char * x);
int main()
{
//ios::sync_with_stdio(false);
#ifdef ONLINE_JUDGE
#else
freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
#endif
for(int i = 0 ; i< 35 ; i++) mp[ s[i] ] = h[i];
while(gets(a))
{
printf("%s",a);
bool x = p(a),y = m(a);
if(x && y) puts(" -- is a mirrored palindrome.");
else if(!x && !y) puts(" -- is not a palindrome.");
else if(x && !y) puts(" -- is a regular palindrome.");
else if(y && !x) puts(" -- is a mirrored string.");
puts("");
}
return 0;
}
bool p(char * x)
{
int left = 0 , right = strlen(x)-1;
while(left<=right)
if(x[left++]!=x[right--]) return 0;
return 1;
}
bool m(char * x)
{
int left = 0 , right = strlen(x)-1;
while(left<=right)
if(mp[x[left++]]!=x[right--]) return 0;
return 1;
}