B. s-palindrome
题目连接:
http://www.codeforces.com/contest/691/problem/B
Description
Let's call a string "s-palindrome" if it is symmetric about the middle of the string. For example, the string "oHo" is "s-palindrome", but the string "aa" is not. The string "aa" is not "s-palindrome", because the second half of it is not a mirror reflection of the first half.
English alphabet
You are given a string s. Check if the string is "s-palindrome".
Input
The only line contains the string s (1 ≤ |s| ≤ 1000) which consists of only English letters.
Output
Print "TAK" if the string s is "s-palindrome" and "NIE" otherwise.
Sample Input
oXoxoXo
Sample Output
TAK
Hint
题意
给你一个字符串,问你是不是S回文串,是S回文串的话,就必须字母也是镜像的。
题解:
非常有趣。。。
面白い
代码
#include<bits/stdc++.h>
using namespace std;
string a = "AbdHIMOopqTUVvWwXxY";
string b = "AdbHIMOoqpTUVvWwXxY";
bool check(char A,char B){
for(int i=0;i<a.size();i++){
if(A==a[i]&&B==b[i])return true;
}
return false;
}
string s;
int main(){
cin>>s;
for(int i=0;i<s.size();i++){
if(!check(s[i],s[s.size()-i-1]))return puts("NIE");
}
return puts("TAK");
}