当前位置:网站首页>[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;
}
边栏推荐
- Safe mode on Windows
- 28io stream, byte output stream writes multiple bytes
- C# AES对字符串进行加密
- MySQL advanced learning summary 9: create index, delete index, descending index, and hide index
- [machine learning notes] univariate linear regression principle, formula and code implementation
- 嵌入式面试题(四、常见算法)
- 应用安全系列之三十七:日志注入
- Figure database ongdb release v-1.0.3
- Easy to understand IIC protocol explanation
- B站刘二大人-线性回归及梯度下降
猜你喜欢
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站刘二大人-线性回归 Pytorch
指针经典笔试题
P2802 回家
Notes, continuation, escape and other symbols
05. 博客项目之安全
Vulhub vulnerability recurrence 69_ Tiki Wiki
Sword finger offer II 039 Maximum rectangular area of histogram
How to download GB files from Google cloud hard disk
02. 开发博客项目之数据存储
随机推荐
JDBC calls the stored procedure with call and reports an error
【SQL server速成之路】——身份驗證及建立和管理用戶賬戶
Pickle and savez_ Compressed compressed volume comparison
Sword finger offer II 039 Maximum rectangular area of histogram
Application Security Series 37: log injection
03. 开发博客项目之登录
Game push: image / table /cv/nlp, multi-threaded start!
清除浮动的方式
Unity gets the width and height of Sprite
PDK工藝庫安裝-CSMC
【torch】|torch. nn. utils. clip_ grad_ norm_
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
04. Project blog log
C AES encrypts strings
Unity Vector3. Use and calculation principle of reflect
Knowledge points of circular structure
Web Security (VI) the use of session and the difference between session and cookie
Pointer classic written test questions
SQLite queries the maximum value and returns the whole row of data
Improve jpopup to realize dynamic control disable