Problem C: 判断回文串
来源:互联网 发布:windows安装python2.7 编辑:程序博客网 时间:2024/05/29 03:57
Description
对于给定的一个字符串,判断是否是回文串。
Input
一个字符串。
Output
如果是一个回文串,则输出YES,否则输出NO。
Sample Input
chinanihc
Sample Output
YES
HINT
注意:
1. 不能使用数组,即程序中不能出现[、]和new。
2. 可以借助vector和stack判断。
Append Code
#include <iostream>#include <stack>#include <queue>using namespace std;int main(){ stack<char> s; queue<char> q; char c; while(cin >> c) { s.push(c); q.push(c); } int flag = 1; while(!s.empty()) { if(s.top() != q.front()) flag = 0; s.pop(); q.pop(); } if(flag) { cout << "YES" << endl; } else { cout << "NO" << endl; } return 0;}
阅读全文
0 0
- Problem C: 判断回文串
- Problem C: 判断字符串是否为回文
- Problem C: 判断字符串是否为回文
- Problem C: 判断字符串是否为回文
- Problem C: 判断字符串是否为回文
- C语言——回文串判断
- c 判断回文字符
- C判断回文数
- C 语言,判断回文
- C 判断回文
- c语言"回文"判断
- C语言判断回文
- Problem C: 是否回文数?
- Problem C: 是否回文数?
- 回文判断(C/C++)
- C语言判断回文数
- C语言 判断回文字符串
- 【c语言】判断回文数组
- python-列表基本操作和方法及其应用
- opencv3_java 矩阵和图像的函数之加和阿尔法融合 add
- ☞【JavaSE目录 下的 所有目录 的 详细目录 信息】☜
- assertion failure 迭代器自加
- 2017 最新 Zcash(ZEC) windows挖矿教程 (非Linux系统)
- Problem C: 判断回文串
- 微信统一下单
- Python 爬取百度网盘所有热门分享文件
- Leetcode052--二叉树路径最大和
- 【学习笔记】python条件语句
- 数值处理函数
- android Spinner控件详解
- hdu3460(Trie树)
- 《四》引入静态文件并输出视图文件