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

题意是说给你一个字符串,看是不是完全对称的,这里需要注意的是这个对称是完全对称的,并不是对应位置是同一个字母,用一个二维数组就可以解决,只要对应位置上是两个中的一个,对称位置上就只能是对应的字母。

细节之处在于把所有对称字母找出来。

AC代码

#include<iostream>
#include<stdio.h>
using namespace std;
char c[19][2]={'A','A','b','d','d','b','H','H','I','I','M','M','O','O','o','o','p','q','q','p','U','U','V','V','v','v','W','W','w','w','X','X','x','x','Y','Y','T','T'};
int main()
{string str;cin>>str;int len=str.length();int f=0;for(int i=0;i<=len/2;i++){int flag=0;for(int j=0;j<19;j++){if(str[i]==c[j][0]&&str[len-i-1]==c[j][1]){flag=1;break;}   }if(flag==0){cout<<"NIE"<<endl;f=1;break;}}if(f==0) cout<<"TAK"<<endl;return 0;
}

s-palindrome相关推荐

  1. 【LeetCode】Palindrome Partitioning 解题报告

    [题目] Given a string s, partition s such that every substring of the partition is a palindrome. Retur ...

  2. 234. Palindrome Linked List - Easy

    Given a singly linked list, determine if it is a palindrome. Example 1: Input: 1->2 Output: false ...

  3. LeetCode 125 Valid Palindrome(有效回文)(*)

    版权声明:转载请联系本人,感谢配合!本站地址:http://blog.csdn.net/nomasp https://blog.csdn.net/NoMasp/article/details/5062 ...

  4. Lintcode108 Palindrome Partitioning || solution 题解

    [题目描述] Given a strings, cutsinto some substrings such that every substring is a palindrome. Return t ...

  5. 数位DP 回文序列 POJ-3280 Cheapest Palindrome

    Cheapest Palindrome [ POJ - 3280 ] 题目大意: 给定字符串s,长度为m,由n个小写字母组成.在s的任意位置增删字母,把它变成回文串,增删特定字母的花费不同,求最小花费 ...

  6. Determine whether an integer is a palindrome. Do this without extra space.

    看到这个题目的时候,首先不认识 Determine这个单词.英文不好没办法,查了下是确认的意思,然后不懂 palindrome这个单词, 查了下是回文的意思. 问题是 回文是个什么东西,官方解释: A ...

  7. [leetcode] Palindrome Number

    2019独角兽企业重金招聘Python工程师标准>>> Determine whether an integer is a palindrome. Do this without e ...

  8. Uva - 12050 Palindrome Numbers【数论】

    题目链接:uva 12050 - Palindrome Numbers 题意:求第n个回文串 思路:首先可以知道的是长度为k的回文串个数有9*10^(k-1),那么依次计算,得出n是长度为多少的串,然 ...

  9. 【leetcode】132. Palindrome Partitioning II

    题目如下: 解题思路:本题是[leetcode]131. Palindrome Partitioning的升级版,要求的是求出最小cuts,如果用[leetcode]131. Palindrome P ...

  10. 409 Longest Palindrome

    Longest Palindrome 这题我完全想错了. 求最长回文.~~统计个个字母出现次数.奇数的保留最大的那个.偶数全保留.~~这个思路完全错了. 因为奇数中成对的数字也是可以拿来用的. 正确的 ...

最新文章

  1. 数据结构[栈与队列]的基本操作
  2. 接口测试 2021 接口测试白皮书 欢迎下载阅读
  3. java字符常量括_Java常量 变量 数据类型
  4. tomcat5应用移植到WAS5.1中的一些问题及解决
  5. 实验吧——SQL注入 Write up(一)
  6. Rootkit之ntrootkit的配置使用
  7. keil5 项目管理
  8. clover config_【兵哥小课堂】不借助任何工具将CLOVER引导添加进UEFI的正确姿势
  9. web前端网页制作 小组作业(制作一个简单的小网页)
  10. 阿里物联网平台(IOT)——业务服务器获取阿里iot平台接入设备的实时设备采集数据
  11. Kali与编程:Winserver 2019 搭建web服务器7-05
  12. 字符串算法:从入门到劝退
  13. make错误 redis6_redis安装make失败,make[1]: *** [adlist.o] Error 127....
  14. 在计算机技术指标中mips用来描述,mips用来描述计算机的什么
  15. 使用IDEA打包项目(jar包和war包)
  16. 计算机辅助设计系统的核心技术是,2 计算机辅助设计技术详解.ppt
  17. 群晖第二篇-挂载外接移动硬盘拷贝数据
  18. 2019年秋季计算机应用基础,天大2019年秋季考试《计算机应用基础》在线考核试题【满分答案】...
  19. 马拉车(manacher)
  20. Android视频直播原理详解

热门文章

  1. 董事、执行董事、总裁、总经理
  2. 从文档流角度理解浏览器页面渲染引擎对元素定位的解析
  3. 指尖的流连.9月13
  4. 折半查找的实现(1010)swust-oj
  5. pat1091. Acute Stroke (30)
  6. 计算机网络学习1-网络层次
  7. Bootstrap+angularjs+MVC3+分页技术+角色权限验证系统
  8. [绝对原创]一些你们想不到的简单方法,就可以让你手机飞快起来!!!
  9. web中“/”写在不同地方时的值不同
  10. 安装scrapy 出现Failed building wheel for Twisted(总是显示此错误)解决办法