当前位置:网站首页>[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;
}
边栏推荐
猜你喜欢
01. 开发博客项目之项目介绍
Check the useful photo lossless magnification software on Apple computer
SQLite add index
[Tang Laoshi] C -- encapsulation: classes and objects
05. 博客项目之安全
03. 开发博客项目之登录
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
网站进行服务器迁移前应做好哪些准备?
B站刘二大人-线性回归及梯度下降
Graduation design game mall
随机推荐
UCF(暑期团队赛二)
Game push: image / table /cv/nlp, multi-threaded start!
B站刘二大人-线性回归 Pytorch
剑指 Offer II 039. 直方图最大矩形面积
指針經典筆試題
【华为机试真题详解】检查是否存在满足条件的数字组合
UCF (summer team competition II)
JS array list actual use summary
HAC cluster modifying administrator user password
Jvxetable用slot植入j-popup
JDBC calls the stored procedure with call and reports an error
Selective parameters in MATLAB functions
Qt TCP 分包粘包的解决方法
网站进行服务器迁移前应做好哪些准备?
Zoom and pan image in Photoshop 2022
Graduation design game mall
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
59. Spiral matrix
Steady, 35K, byte business data analysis post
应用安全系列之三十七:日志注入