题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=342
题意镜像和回文串判断
代码:
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
char s[30];
while(cin >> s)
{
//pan duan hui wen
int len = strlen(s);
int hw = 1;
for(int i = 0; i <= len / 2; i++)
{
if(s[i] != s[len - i - 1])
{
hw = 0;
break;
}
}
//pan duan jing xiang
int jx = 1;
for(int i = 0; i <= len / 2; i++)
{
if(s[i] == 'A')
{
if(s[len - i - 1] != 'A')
{
jx = 0;
break;
}
}
else if(s[i] == 'E')
{
if(s[len - i - 1] != '3')
{
jx = 0;
break;
}
}
else if(s[i] == 'H')
{
if(s[len - i - 1] != 'H')
{
jx = 0;