回文串思路和参考代码(C语言)
摘要:解题思路:首先注意到字符串长度小于255,所以我们定义一个255个存储单元的数组即可,然后用scanf读入字符串,strlen函数得到字符个数,最后for循环判断。注意事项:参考代码:#include……
要初始化数组,且长度与下标差一个,gets丢弃换行符,加入结尾符,但统计不包含结尾符
摘要:#include<stdio.h>
#include<string.h>
#include<malloc.h>
int main(){
char ch[255] = {0};
i……
回文串不使用reverse解法(Python)
摘要:解题思路:注意事项:参考代码:str=input()n=len(str)m=0for i in range (0,n): if str[i]==str[-1-i]: m=m+1 ……