cf(420A)

202 篇文章 0 订阅
42 篇文章 0 订阅

A. Start Up
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Recently, a start up by two students of a state university of city F gained incredible popularity. Now it's time to start a new company. But what do we call it?

The market analysts came up with a very smart plan: the name of the company should be identical to its reflection in a mirror! In other words, if we write out the name of the company on a piece of paper in a line (horizontally, from left to right) with large English letters, then put this piece of paper in front of the mirror, then the reflection of the name in the mirror should perfectly match the line written on the piece of paper.

There are many suggestions for the company name, so coming up to the mirror with a piece of paper for each name wouldn't be sensible. The founders of the company decided to automatize this process. They asked you to write a program that can, given a word, determine whether the word is a 'mirror' word or not.

Input

The first line contains a non-empty name that needs to be checked. The name contains at most 105 large English letters. The name will be written with the next sans serif font:

Output

Print 'YES' (without the quotes), if the given name matches its mirror reflection. Otherwise, print 'NO' (without the quotes).

Sample test(s)
input
AHA
output
YES
input
Z
output
NO
input
XO
output
NO

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<algorithm>
#include<math.h>
using namespace std;
char x[100010];
char a[11]={'A','H','I','M','O','T','U','V','W','X','Y'};
int main()
{
    cin>>x;
    int l=strlen(x);
    int flag=1;
        for(int i=0;i<=l/2;i++)
        if(x[i]!=x[l-i-1])
        {
            flag=0;break;
        }else
        {
            flag=0;
            for(int j=0;j<11;j++)
                if(x[i]==a[j])
            {flag=1;break;}
            if(!flag)break;
        }
        if(flag)cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    return 0;
}











  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值