我是萌新 ,不是很会 ,请求哪位大神 帮我把程序编出来 。
题目:字符串s中包含若干个回文字符子串,找出其中所有长度大于2的回文字符串,
然后将其存放在字符串数组str中,若某个回文字符串已在该数组中,则丢弃。
例如:字符串s为:"ILoLoL.jiangsu151uhj";
其中,回文子串有:"LoLoL", "LoL", "oLo", "LoL", "u151u","151"
在str中存储的字符串为:
LoLoL
u151u
LoL
oLo
151
编写程序:
从串s的start
下标至最后一个字符之间查找回文字符串,若找到则保存到字符串数组str中。
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <ctype.h>
#define N 250
#define M 250
int main()
{ char s[N]="ILoLoL.jiangsu151uhj";
char str[M][N]= {"\0"};
/Program/
/**********End **********/
printf("长度大于2的回文字符串有:\n");
for(i=0; str[i][0]; i++)
puts(str[i]);
return 0;
}