当前位置:网站首页>[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;
}
边栏推荐
猜你喜欢

Zoom and pan image in Photoshop 2022

Installation de la Bibliothèque de processus PDK - csmc

【torch】|torch. nn. utils. clip_ grad_ norm_

Fluent implements a loadingbutton with loading animation

04. Project blog log

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站刘二大人-Softmx分类器及MNIST实现-Lecture 9

【LeetCode】18、四数之和

B站刘二大人-反向传播

自建DNS服务器,客户端打开网页慢,解决办法
随机推荐
注释、接续、转义等符号
Summary of deep learning tuning tricks
Promotion hung up! The leader said it wasn't my poor skills
UCF (2022 summer team competition I)
59. Spiral matrix
Web Security (VI) the use of session and the difference between session and cookie
【云原生】3.1 Kubernetes平台安装KubeSpher
P2802 回家
Solution of QT TCP packet sticking
js Array 列表 实战使用总结
Pointer classic written test questions
Improve jpopup to realize dynamic control disable
[QNX hypervisor 2.2 user manual]6.3.3 using shared memory (shmem) virtual devices
[imgui] unity MenuItem shortcut key
改善Jpopup以实现动态控制disable
剑指 Offer II 039. 直方图最大矩形面积
02. Develop data storage of blog project
How can large websites choose better virtual machine service providers?
Problems encountered in installing mysql8 on MAC
UCF(暑期团队赛二)