I can’t figure out what’s wrong with my code. It works fine on my machine???
#include<stdio.h>
#include<string.h>
#define SIZE 10000
int repstring(char a[], int len )
{
char substr[20][10] ={'\0'};
int k=0,count2=0,i,j,h,count,l;
for(i=0;i<=strlen(a)-len;i++)
{
for(j=i;j-i<len;j++)
substr[k][j-i]=a[j];
substr[k][j-i]='\0';
for(h=0;h<k;h++)
{count=1;
for(l=h+1;l<=k;l++)
if(strcmp(substr[h],substr[l])==0)
count++;
if(count>count2)
count2=count;
}
k++;
}
return count2;
}
int main()
{
int count,count2,l,h,i,j;
char a[SIZE];
do
{
scanf("%d",&l);
scanf("%d",&h);
if(l==0 && h==0)
break;
scanf("%s",&a);
count =0;
for (i=l;i<=h;i++)
{
count2=repstring(a,i);
if(count2>count)
{
count=count2;
j=i;
}
}
printf("%d %d",count,j);
}while(1);
return 0;
}