B. 完美对称

B. 完美对称

我们把一个完全对称的字符串称为“完美对称”的字符串,请仔细观察字母表,判断给出的字符串是否“完美对称”。

Input
案例有多组,每组给出一个只由大小写字母组成的字符串,长度不大于1000。

Output
每行输出一个答案,如果给出的字符串位“完美对称”,输出“Yes”,否则,输出“No”。

Sample Input
AoA
aoa
Sample Output
Yes
No

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<cctype>
#include<functional>
using namespace std;
#define swap(a,b) {long long c=a;a=b;b=c;}
const int MAX = 999999;
const double Eps = 1e-12;
const double PI = acos(-1.0);
int gcd(int x, int y)
{
    return x%y == 0 ? y : gcd(y, x%y);
}

int main()
{



    int i, len, count;
    char a[2000], b[2000], c[2000];
    memset(a, '\0', sizeof(a));
    while (cin >> a)
    {
        count = 0;
        memset(b, '\0', sizeof(b));
        memset(c, '\0', sizeof(c));
        len = strlen(a);
        for (i = 0; i<len; i++)
        {
            if (a[i] == 'A')
                c[i] = 'A';
            if (a[i] == 'b')
                c[i] = 'd';
            if (a[i] == 'd')
                c[i] = 'b';
            if (a[i] == 'H')
                c[i] = 'H';
            if (a[i] == 'I')
                c[i] = 'I';
            if (a[i] == 'M')
                c[i] = 'M';
            if (a[i] == 'O')
                c[i] = 'O';
            if (a[i] == 'o')
                c[i] = 'o';
            if (a[i] == 'p')
                c[i] = 'q';
            if (a[i] == 'q')
                c[i] = 'p';
            if (a[i] == 'T')
                c[i] = 'T';
            if (a[i] == 'U')
                c[i] = 'U';
            if (a[i] == 'V')
                c[i] = 'V';
            if (a[i] == 'v')
                c[i] = 'v';
            if (a[i] == 'W')
                c[i] = 'W';
            if (a[i] == 'w')
                c[i] = 'w';
            if (a[i] == 'X')
                c[i] = 'X';
            if (a[i] == 'x')
                c[i] = 'x';
            if (a[i] == 'Y')
                c[i] = 'Y';
        }
        for (i = 0; i < len; i++)
            b[i] = a[len - 1 - i];
        if (!strcmp(b, c))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
    return 0;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值