您的位置:首页 > 其它

Codeforces-691B-s-palindrome(模拟)

2016-07-16 14:29 501 查看
B. s-palindrome

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard output

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.

Examples

input

oXoxoXo

output

TAK

input

bod

output

TAK

input

ER

output

NIE

坑点全在这里

#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
#include<queue>
#include<iomanip>
using namespace std;
const int maxn=2222;
bool is_mirror(char A,char B)//A和B成镜像返回1,否则返回0
{
if(A=='A'&&B=='A')
return 1;
if(A=='H'&&B=='H')
return 1;
if(A=='I'&&B=='I')
return 1;
if(A=='M'&&B=='M')
return 1;
if(A=='O'&&B=='O')
return 1;
if(A=='T'&&B=='T')
return 1;
if(A=='U'&&B=='U')
return 1;
if(A=='V'&&B=='V')
return 1;
if(A=='W'&&B=='W')
return 1;
if(A=='X'&&B=='X')
return 1;
if(A=='Y'&&B=='Y')
return 1;
if(A=='v'&&B=='v')
return 1;
if(A=='w'&&B=='w')
return 1;
if(A=='x'&&B=='x')
return 1;
if(A=='o'&&B=='o')
return 1;

if(A=='p'&&B=='q')//下面几条涨姿势
return 1;
if(A=='q'&&B=='p')
return 1;
if(A=='b'&&B=='d')
return 1;
if(A=='d'&&B=='b')
return 1;
//    if(A=='d'&&B=='p')
//        return 1;
//    if(A=='p'&&B=='d')
//        return 1;
//    if(A=='b'&&B=='q')
//        return 1;
//    if(A=='q'&&B=='b')
//        return 1;
return 0;
}
int main()
{
char str1[maxn];
scanf("%s",str1);
int len=strlen(str1);
char str2[maxn];
for(int i=0; i<=len-1; i++)
str2[len-i-1]=str1[i];
for(int i=0; i<=len-1; i++)
if(is_mirror(str1[i],str2[i])==0)
{
printf("NIE\n");
return 0;
}
printf("TAK\n");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: