当前位置:网站首页>[string] palindrome string of codeup
[string] palindrome string of codeup
2022-07-06 05:37:00 【Moliay】
Title Description
Read in a string of characters , Determine whether it is a palindrome string .“ Palindrome string ” It's a string that is read both forward and backward , such as “level” perhaps “noon” And so on are palindrome strings .
Input
One line string , Length not exceeding 255.
Output
If it's a palindrome string , Output “YES”, Otherwise output “NO”.
The sample input Copy
12321
Sample output Copy
YES
solution
#include <stdio.h>
#include <string.h>
int main(){
char m[256];
scanf("%s", m);
int l = strlen(m), i;
for(i = 0; i < l / 2; i++){
if(m[i] != m[l - i - 1]){
printf("NO");
break;
}
}
if(i >= l / 2)
printf("YES");
return 0;
}
边栏推荐
- Graduation design game mall
- (column 22) typical column questions of C language: delete the specified letters in the string.
- [machine learning notes] univariate linear regression principle, formula and code implementation
- 【SQL server速成之路】——身份驗證及建立和管理用戶賬戶
- Deep learning -yolov5 introduction to actual combat click data set training
- 02. Develop data storage of blog project
- JDBC calls the stored procedure with call and reports an error
- Quantitative description of ANC noise reduction
- Promotion hung up! The leader said it wasn't my poor skills
- 05. Security of blog project
猜你喜欢
随机推荐
Codeforces Round #804 (Div. 2) Editorial(A-B)
无代码六月大事件|2022无代码探索者大会即将召开;AI增强型无代码工具推出...
B站刘二大人-Softmx分类器及MNIST实现-Lecture 9
Vulhub vulnerability recurrence 69_ Tiki Wiki
[cloud native] 3.1 kubernetes platform installation kubespher
How to use PHP string query function
Easy to understand I2C protocol
UCF(暑期团队赛二)
Web Security (V) what is a session? Why do I need a session?
02. Develop data storage of blog project
Detailed summary of SQL injection
清除浮动的方式
01. 开发博客项目之项目介绍
What impact will frequent job hopping have on your career?
What preparations should be made for website server migration?
In 2022, we must enter the big factory as soon as possible
(column 22) typical column questions of C language: delete the specified letters in the string.
Pytorch代码注意的细节,容易敲错的地方
What is independent IP and how about independent IP host?
Vulhub vulnerability recurrence 72_ uWSGI