Coder-Strike 2014 - Finals (online edition, Div. 2) B. Start Up

 需要满足的条件是

(1)每个字母是对称的

(2)每个字符串是对称的

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
const string mirrorChar = "AHIMOTUVWXY";
int main(){
    string str;
    cin >> str;
    bool flag = true;
    for(int i = 0 ; i < str.length(); ++ i){
        if(mirrorChar.find(str[i])==string::npos) {
            flag = false;break;
        }
    }
    if(flag && str == string(str.rbegin(),str.rend())) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}

 

posted @ 2014-04-22 23:34  OpenSoucre  阅读(265)  评论(0编辑  收藏  举报