首页 > 试题广场 >

回文字符串

[编程题]回文字符串
  • 热度指数:23057 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 64M,其他语言128M
  • 算法知识视频讲解
给出一个长度不超过1000的字符串,判断它是不是回文(顺读,逆读均相同)的。

输入描述:
输入包括一行字符串,其长度不超过1000。


输出描述:
可能有多组测试数据,对于每组数据,如果是回文字符串则输出"Yes!”,否则输出"No!"。
示例1

输入

hellolleh
helloworld

输出

Yes!
No!
头像 用户抉择
发表于 2021-03-09 22:46:30
#include <stdio.h> #include <string.h> int main() {     char s[1000];     int 展开全文
头像 coding_X
发表于 2024-01-19 22:03:31
#include <iostream> #include <string> #include <cstring> using namespace std; int main() { string a; int lena = 0; whil 展开全文
头像 爱交友的马后炮炮手在创作
发表于 2024-03-03 15:45:28
#include <stdio.h> #include <string.h> int main() { char a[2000]; while (scanf("%s ", a) != EOF) { int i=strlen( 展开全文
头像 牛客745135892号
发表于 2024-03-05 20:51:37
#include<iostream> using namespace std; int main() { string s; while (cin >> s) { int len = s.size(); bool flag = 展开全文
头像 牛客135089235号
发表于 2024-02-29 22:35:27
#include<iostream> #include<algorithm> using namespace std; int main() { string a; while(cin >> a) { string b = a; reverse(a 展开全文
头像 尤姆
发表于 2023-03-12 12:01:28
#include<iostream> #include<string> using namespace std; int main(){ string str; while (cin >> str){ string rev; for (int i = 展开全文
头像 牛客772077707号
发表于 2023-03-14 23:15:51
#include <bits/stdc++.h> using namespace std ; int main() { string s ; while(cin >> s) { int len = s.length() ; 展开全文
头像 bigbigcake
发表于 2024-03-12 20:00:43
#include <bits/stdc++.h> using namespace std; int main() { string s; while (getline(cin,s)) { // 注意 while 处理多个 case string s2 = 展开全文
头像 给我就亿下
发表于 2023-03-27 20:22:23
#include <iostream> using namespace std; bool isReverse (string s){ string s1; for (int i = s.size() - 1; i >= 0; i--){ s1.push_back(s[ 展开全文
头像 陈方长
发表于 2023-03-07 11:24:03
#include<bits/stdc++.h> using namespace std; int main(){ string s; while(cin>>s){ int ls=s.length(); int flag=1; 展开全文

问题信息

难度:
206条回答 19618浏览

热门推荐

通过挑战的用户

查看代码