回文字符串问题
来源:互联网 发布:怪物猎人p3多玩数据库 编辑:程序博客网 时间:2024/06/05 23:47
A - 回文串问题
Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu
Submit
Status
Practice
CSU 1260
Description
“回文串”是一个正读和反读都一样的字符串,字符串由数字和小写字母组成,比如“level”或者“abcdcba”等等就是回文串。请写一个程序判断读入的字符串是否是“回文”。
Input
输入包含多个测试实例,每一行对应一个字符串,串长最多100字母。
Output
对每个字符串,输出它是第几个,如第一个输出为”case1:”;如果一个字符串是回文串,则输出”yes”,否则输出”no”,在yes/no之前用一个空格。
Sample Input
level
abcde
noon
haha
Sample Output
case1: yes
case2: no
case3: yes
case4: no
中文水题:回文字符串的处理
#include<iostream>#include<cstdio>#include<cstring>#include<string>#include<algorithm>using namespace std ;int main(){ string str ; int count = 0 ; while(cin>>str){ bool flag = false ; //cout<<str<<endl ; int n = str.length(); for(int i = 0 ; i < n/2 ; i++){ if(str[i]==str[n-i-1]){ continue ; } else{ flag = true ; } } if(flag == true){ cout<<"case"<<++count<<":"<<" no"<<endl; } else{ cout<<"case"<<++count<<":"<<" yes"<<endl; } } return 0 ; }
0 0
- Palindrome<回文>字符串问题
- 回文字符串切割问题
- 回文字符串问题
- 回文字符串问题
- 回文字符串问题
- 回文字符串问题
- 回文字符串ACM问题
- 最长回文字符串问题
- 回文数与回文字符串问题
- 回文字符串 的添加问题
- 字符串回文问题及其扩展
- 最长回文子字符串问题
- 字符串回文子序列问题
- DP问题 制造回文字符串
- Leetcode-字符串问题--最长的回文字符串
- hpuoj 1699: 回文串问题 (回文字符串&manacher)
- 一道特殊的回文字符串处理问题
- 查找字符串中的最长回文问题评述
- glClipPlane剪裁平面
- iTunes Connect新应用发布流程
- jquery学习网站
- Linux【5】
- winscp 连接 linux
- 回文字符串问题
- java string类型转换boolean类型
- 快捷的办法找到并删除 Xcode 工程中没用到的图片
- 简单工厂方法、工厂方法以及抽象工厂方法的区别
- shell输入密码隐藏回显
- Tomcat log4j配置
- oracle数据库客户端无法分发数据库连接
- cuda 安装方法
- 利用GPU加速的软件