/*****************************************************
copyright (C), 2014-2015, Lighting Studio. Co., Ltd.
File name:
Author:Jerey_Jobs Version:0.1 Date:
Description:
Funcion List:
*****************************************************/
#include <stdio.h>
int main()
{
char a[
100];
int i =
2,j =
2;
int max =
0,temp =
0;
int len;
int flag =
0;
printf(
"enter the string and the length :\n");
scanf(
"%s %d",a,&len);
while( i < len)
{
if(a[i] == a[i - j])
{
temp = temp +
1;
i = i +
1;
j = j +
2;
flag =
1;
}
else
{
i++;
flag =
0;
}
if(max < temp)
{
max = temp;
}
if(flag ==
0)
{
j =
2;
temp =
0;
}
}
printf(
"the max is %d\n",
2 * max +
1);
return 0;
}
转载请注明原文地址: https://ju.6miu.com/read-970437.html