semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int fd,m[13]={0,3,0,3,2,3,2,3,3,2,3,2,3},i;
	cin>>fd;
	for(i=0;i<12;i++)
	{
	    if((fd+(m[i]+5)%7)%7==5)
			cout<<i+1<<endl;
		fd+=m[i];
	}
	return 0;
}
// ****************************
// ??? ? ????
// ?? ? ??? 1300012972
// ?? ? 12.15
// ****************************




int main()
{
	char str[500], *p;
	int j, num[500] = {0}, len, k, m, max = 0, *q;
	
	cin >> m >> str;         // m??????

	len = strlen(str);       // ????????

	for (p = str, q = num; p <= str + len - m; p++, q++)  //  ????????????????????????????
	{
		(*q)++;

		for (j = 1; p + j <= str + len - m; j++)
		{
			for (k = 0; k < m; k++)              //  ??????????
				if (*(p + k) != *(p + j + k))
					break;
			if (k == m)
				(*q)++;
		}

		if (max < *q)                         // ??????????
			max = *q;
	}
	
	if (max < 2)                            // ??????????
		cout << "NO" << endl;
	else
	{
		cout << max << endl;

		for (q = num, p = str; q <= num + len - m; q++, p++)
			if (max == *q)
			{
				for (k = 0; k < m; k++)
					cout << *(p + k);
				cout << endl;
			}
	}

	return 0;
}
int main(){
	char s[600];
	int n;
	char ans[100][10];
	int acnt=0;
	int mx=0;
	cin>>n;
	cin>>s;
	for(int i=0;s[i+n]!='\0';i++){
		int cnt=1;
		for(int j=i+1;s[j+n-1]!='\0';j++){
			int k;
			for(k=0;k<n;k++){
				if(s[i+k]!=s[j+k])break;
			}
			if(k==n)cnt++;
		}
		if(cnt>mx){
			mx=cnt;
			acnt=1;
			for(int j=0;j<n;j++)ans[acnt][j]=s[i+j];
			ans[acnt][n]='\0';
		}
		else if(cnt==mx){
			acnt++;
			for(int j=0;j<n;j++)ans[acnt][j]=s[i+j];
			ans[acnt][n]='\0';
		}
	}
	if(mx!=1){
		cout<<mx<<endl;
		for(int i=1;i<=acnt;i++){
			cout<<ans[i]<<endl;
		}
	}
	else{
		cout<<"NO";
	}
	
}
int main()
{
	int n,l,i,j,m=0,k=0;
	char a[600],*p,(*s)[7],(*q)[7],b[600][7],c[600][7],(*t)[7];
	scanf("%d%s",&n,a);
	p=a;
	q=b;
	s=c;
	l=strlen(a);
	for(i=0;i<l-n+1;i++)
	{
		strncpy(*q,p,n);
	*(*q+n)='\0';
		p++;q++;
	}
	q=b;
	for(i=0;i<l-n+1;i++)
	{
		k=0;t=b;
		for(j=0;j<l-n+1;j++)
		{
			if(strcmp(*t,*q)==0)
				k++;
			t++;

		}
		if(k>m)
		{
			m=k;
			s=c;
			strcpy(*s,*q);
		}
		else if(k==m&&strcmp(*s,*q)!=0)
		{
			s++;
			strcpy(*s,*q);
		}
		q++;
	}
	l=s-c+1;
	if(m==1)
		printf("NO");
	else
	{
		printf("%d\n",m);
		s=c;
		for(i=0;i<l;i++)
		{
			k=0;
			t=c;
			for(;t<s;)
			{
				if(strcmp(*t,*s)==0)
					k++;
				t++;
			}
			if(k==0)
			puts(*s);
			s++;
		}
	}
	return 0;
}
int main()
{
	int n,a[500],h,i,o,z,m,b,l,t,f=0,u,k=0;
	char c[500];
	scanf("%d",&n);
	getchar();
	gets(c);
	for(h=0;h<500;h++)
	{
		a[h]=0;
	}
	b=strlen(c);
	t=b-n;
	for(i=0;i<=t;i++)
	{
		for(o=i;o<=t;o++)
		{
			for(u=0;u<=n-1;u++)
			{
				if (c[i+u]==c[o+u])
					k+=1;
			}
			if(k==n)
				a[i]+=1;
			k=0;
		}
	}
	z=a[0];
	for(l=1;l<=t;l++)
	{
		if(a[l]>z)
		{
			f=l;
			z=a[l];
		}
	}
	if(z==1)
		printf("NO");
	else
	{
		printf("%d",z);
		for(m=0;m<=t;m++)
		{
			if (a[m]==z)
			{
				printf("\n%c",c[m]);
				for(u=1;u<=n-1;u++)
				{
					printf("%c",c[m+u]);
				}
			}
		}
	}
	return 0;
}
int main() {
	char s[600];
	int len;
	int i;
	int j;
	int n;
	int k;
	int max;
	int idx[1000];
	int count[1000] = {0};
	scanf("%d", &n);
	scanf("%s", s);
	len = strlen(s);
	k=0;
	for(i=0; i<=len-n; i++) {
		for(j=0; j<k; j++) {
			if(strncmp(s+i, s+idx[j], n) == 0) {
				count[j]++;
				break;
			}
		}
		if(j == k) {
			idx[k] = i;
			count[k] = 1;
			k++;
			count[k] = 0;
		}
	}
	max = -1;
	for(i=0; i<k; i++) {
		if(count[i] > max) {
			max = count[i];
		}
	}
	if(max <= 1) {
		printf("NO\n");
		return 0;
	}
	printf("%d\n", max);
	for(i=0; i<k; i++) {
		if(count[i] == max) {
			for(j=idx[i]; j<idx[i]+n; j++) {
				printf("%c", s[j]);
			}
			printf("\n");
			//printf("%s\n", s.substr(idx[i], n));
		}
	}
	return 0;
}
int main()
{
	char a[600];
	char b[600][10];
	char s[10];
	int c[600]={0};
	int n,l,i,j,k,m,max;
	scanf("%d\n",&n);
	gets(a);
	l=strlen(a);
	k=0;
	for(j=0;j<n;j++)
		{
			b[0][j]=a[j];
		}
	b[0][n]='\0';
	for(i=1;i<=l-n;i++)
	{
		for(j=0;j<n;j++)
		{
			s[j]=a[i+j];
		}
		s[n]='\0';
		for(m=0;m<=k;m++)
		{
			if(strcmp(s,b[m])==0)
			{
				c[m]++;
				break;
			}
		}
		if(m==k+1)
		{
			k++;
			strcpy(b[k],s);
		}
		
	}
	max=0;
	for(i=0;i<=k;i++)
	{
		if(c[i]>max)
			max=c[i];
	}
	if(max==0)
		printf("NO");
	else
	{
		printf("%d\n",max+1);
		for(i=0;i<=k;i++)
		{
			if(c[i]==max)
			{
				puts(b[i]);
			}
		}
	}
	return 0;
}
int main()
{
	int n;
	char moto[510];
	char (*a)[7];
	scanf("%d", &n);
	scanf("%s", moto);
	int len;
	len = strlen(moto);
	int i, j;


	a = (char(*)[7])malloc(sizeof(char(*)[7])*(len - n + 1));
	int t[500];
	for (i = 0; i < 500; i++)
		t[i] = 1;


	for (i = 0; i + n <= len; i++)
	{
		for (j = 0; j < n; j++)
		{
			*(*(a + i) + j) = *(moto + i + j);
		}
		*(*(a + i) + n) = '\0';
	}

	len = len - n + 1;
	int max = 1;
	char zero[7] = { '0' };
	for (i = 1; i < len; i++)
	{
		for (j = 0; j < i; j++)
		{
			if (strcmp(*(a + j), *(a + i)) == 0)
			{
				*(t + j) += 1;
				strcpy(*(a + i), zero);
				break;
			}
		}
	}

	for (j = 0; j<len; j++){
		if (*(t + j)>max)
			max = *(t + j);
	}
	if (max > 1)
	{
		printf("%d\n", max);
		for (i = 0; i < len; i++)
		{
			if (*(t + i) == max)
				printf("%s\n", *(a + i));
		}
	}
	else
		printf("NO");
}
int main() 
{
     int n,y=0;
     scanf("%d",&n);
     char a[500];
     scanf("%s",a);
     int b[500];
     int s=strlen(a);
     for(int i=0;i<s-n+1;i++)
     {
         b[i]=1;
         for(int d=1;d<s;d++)
     {
         int m=0,t;
         for(t=i;t<i+n;t++)
         {
         if(a[t]==a[t+d])
         m++;
         }
               if(m==n)
               b[i]++;
     }
     }
     for(int e=0;e<s-n;e++)
     {
             int f ,w=0;
             for(f=0;f<s-n;f++)
             {
                     if(b[e]<b[f]);
                     else w++;
             }
             if(w==s-n)
             { 
                       
                       if(b[e]>1){y++;
                       if(y==1)
                       printf("%d\n",b[e]);
                       for(int p=0;p<n;p++)
                       {printf("%c",a[e+p]);}
                       printf("\n");}
                       else { printf("NO\n");break;}
             }
     }
         
}
int main()
{
    int n,i,len,j,c[600] = {0},max = 0;
    char a[600],*p,b[600][5];
    cin >> n;
    cin.get();//???? 
    p = a;
    cin.getline(p,600);
    len = strlen(p);
    for (i = 0;i <= len - n;i++)//?????n????????????b? 
        for (j = 1;j <= n;j++)
        {
            b[i][j] = *(p + i + j - 1);
        }
    for (i = 0;i < len - n;i++)
        for (j = i + 1;j <= len - n;j++)//?????????????n????? 
            for (int k = 1;k <= n;k++)//????????????? 
            {
                if (b[i][k] - b[j][k] != 0)
                break;
                if (k == n)//????????????????c???? 
                c[i]++;
            }
    for (i = 0;i <= len - n;i++)
    {
        if (c[i] > max)
        max = c[i];
    }
    if (max == 0)//??c??????????????????1?????0???NO 
    cout << "NO";
    else
    {
        cout << max + 1 << endl;//??????????? 
        for (i = 0;i <= len - n;i++)
        {
            if (c[i] == max)//?????????max???????? 
            {
                     for (j = 1;j <= n;j++)
                     {
                         if (j == n)
                         cout << b[i][j] << endl;
                         else 
                         cout << b[i][j];
                     }
            }
        }
    }
    return 0;
}
int main()
{
	//int num = 0;
	int a[500] = {0}, max = 0;
	char temp[5];
	int n;
	char str[500];
	cin >> n;
	cin >> str;int m;
	for (int i = 0; i <= strlen(str) - n; i++)
	{
		for (int k = i; k < i + n; k++)
		{
			temp[k - i] = str[k];
		}
		for (int j = i + 1; j <= strlen(str) - n; j++)
		{
			for (m = 0; m < n ;m++)
			{
				if (temp[m] != str[j + m])
					break;
			}
			if (m == n)
			{
				a[j] = -1000;
				a[i]++;
				max = max > a[i]? max:a[i];
			} 
		}
	}
	if (max)
	{
		cout << max + 1 << endl;
		for (int i = 0; i <= strlen(str) - n; i++)
		{
			if (a[i] == max)
			{
				for (int p = i; p < i + n; p++)
				{
					cout << str[p];
				}
				cout << endl;
			}
		}
	}
	else
	  cout << "NO";
	return 0;
}
void main()
{
	char a[400],b[400][6];
	int k,i,j=0,n,m=1,q=0;
	scanf("%d",&k);
	scanf("%s",a);
	n=strlen(a);
	for(i=0;i<n-k+1;i++)
	{
		for(j=0;j<k;j++)
		{
			b[i][j]=a[i+j];

		}
		b[i][j]='\0';
	}
	for(j=0;j<n-k;j++)
	{	m=0;
		for(i=j;i<n-k+1;i++)
		{
			if(strcmp(b[j],b[i])==0)m=m+1;
		}
		if(m>q)q=m;
		

	}
	if(q==1)printf("NO");
	else{
	printf("%d\n",q);
	for(j=0;j<n-k;j++)
	{	m=0;
		for(i=j;i<n-k+1;i++)
		{
			if(strcmp(b[j],b[i])==0)m=m+1;
		}
		if(m==q)printf("%s\n",b[j]);
	
	}}
}
int main()

{  int n,i,j=0,j2,k=0,a[500],c[500];
  scanf("%d",&n);
  int t=n; 
  char v[503],b[503][30];
  scanf("%s",v);
  for(int i=0;i<=strlen(v)-1;i++)
   { 
          
     b[k][j]=v[i];
     j++;
     if((j==n)&&(i!=strlen(v)-1)) 
      { 
        j=0;     
        i=i-n+1;     
        k++; 
      }
      else if((j==n)&&(i==strlen(v)-1))
       {break;}      
   }    
 for(int i=0;i<=strlen(v)-n;i++)
  { 
      a[i]=0;
      int l=0; 
     for(int j=0;j<=strlen(v)-n;j++)
       {  
         for(int p=0;p<=n-1;p++)
           {
            if(b[i][p]==b[j][p])
             {
               l++;                 
             }
           }  
         if(l==n){a[i]++;l=0;}
         else{l=0;}    
       }      
  }    
 for(int i=0;i<=strlen(v)-n;i++)
    {
       c[i]=a[i];   
    }
 int e=0;
 for(int i=0;i<=strlen(v)-n;i++)
 {
    if(a[i]==1){e++;}
  }
  if(e==strlen(v)-n+1){printf("NO");}
 else {
      
      e=c[0];
  for(int i=0;i<=strlen(v)-n;i++)           
 {
    if(c[i]>e)
      { 
         e=c[i];          
      }
         
  }
  
  printf("%d\n",e);
  int m[500],z=0,o=0,pa=1; 
 for(int i=0;i<=strlen(v)-n;i++)
  { 
    if(a[i]==e)
    {m[z]=i;z++;}      
  }
for(int i=0;i<=z-1;i++)
 { pa=1;
   if(i!=0)
     {
       for(int r=i-1;r>=0;r--)
        { 
              
      if(strcmp(b[m[i]],b[m[r]])==0){
                                     pa=0;
                                     break;
                                     }
      }
      }
   if(pa!=0)
   {
     for(int j2=0;j2<=n-1;j2++)     
     {
      printf("%c",b[m[i]][j2]);
     }
      { printf("\n");}
   }
 }
} 
 int y;scanf("%d",&y);
 return 0;
}
//********************************
//*???n-gram????   **
//*????? 1300012707 **
//*???2013.12.10**
//********************************
int main()
{
	char c[502];
	int a[502], n, max, i, t, j;
	char *p = c, *p1 = c;
	int *q = a;
	cin >> n;
	cin >> c;
	max = 0;
	for ( q = a; q <= &a[501]; q++)
	{
		*q = 0;
	}
	for ( p = c; *p != '\0'; p ++)
	{
		q = a;
		for ( p1 = c; p1 <= p; p1++)
		{
			t = 1;
			for ( i = 0; i < n; i = i + 1)
			{
				if ( *(p + i) != *(p1 + i))
				{
					t = 0;
					break;
				}
			}
			if ( t == 1)
			{
				*q = *q + 1;
				break;
			}
			q++;
		}
	}
	for ( q = a; q <= &a[501]; q++)
	{
		if ( *q > max)
		{
			max = *q;
		}
	}
	if ( max == 1) 
	{
		cout << "NO" << endl;
	}
	else
	{
    	cout << max << endl;
    	for ( i = 0; i < 502; i = i + 1)
		{
	    	if ( a[i] == max)
			{
		    	p = c;
		    	for ( j = 0; j < n; j = j + 1)
				{
			    	cout << *(p + i + j);
				}
		    	cout << endl;
			}
		}
	}
	return 0;
}
int main()
{
	char str[500];
	int i, j, num[500] = {0}, len, k, m, max = 0;	
	cin >> m >> str;
	len = strlen(str);
	for (i = 0; i <= len - m; i++)
	{
		for (j = i + 1; j <= len - m; j++)
		{
			for (k = 0; k < m; k++)
				if (str[i + k] != str[j + k])
					break;
			if (k == m)
				num[i]++;
		}
	}
	for (i = 0; i <= len - m; i++)
		if (max < num[i] + 1)
			max = num[i] + 1;
	if (max < 2)
		cout << "NO" << endl;
	else
	{
		cout << max << endl;
		for (i = 0; i <= len - m; i++)
			if (max == num[i] + 1)
			{
				for (k = 0; k < m; k++)
					cout << str[i + k];
				cout << endl;
			}
	}
	return 0;
}
//********************************
//*???n-gram????   **
//*?????? 1300012713 **
//*???2013.12.11  **
//********************************
int main()
{
	int n, num = 1, max = 1, ge = 1,flag = 1; //???????n,????num,??????max,??????ge
	char str[505], a[500][5], d[500][5];//???str,??gram??????d
	cin >> n >> str; //??
	int c = strlen(str);//??c???????
	for(int i = 0; i <= c-n; i++)
	{
		for(int j = 0; j < n; j++)
			a[i][j] = *(str+i+j); //?????????
		a[i][n] = '\0'; //?????
	}
	for(int k = 0; k <= c-n; k++)
	{
		if(strcmp(a[k], "0000") == 0) //????? ??
		{
			continue;
		}
		for(int l = 1; l < c-n-k+1; l++) //
		{
			if(strcmp(a[k],a[k+l]) == 0) //??????
			{
				num++; 
				strcpy(a[k+l], "0000");
			}
		}
		if(num > max) //?????????
		{
			ge = 1;
			max = num;
			strcpy(d[ge],a[k]);
			flag = 0;

		}
		if(num == max && flag == 1) //???????????
		{
			ge++;
			strcpy(d[ge],a[k]);
		}
		flag = 1; //???????
		num = 1;
	}
	if(max == 1) //?????????1???? NO
	{
		cout << "NO" << endl;
		return 0;
	}
	cout << max << endl; //??
	for(int p = 1; p <= ge; p++)
		cout << *(d+p) << endl;
	return 0;
}
int main()
{
	int n;
	char a[1000]="";
	char b[500][5]={""};
	int count[500]={0};
	int i;
	int j;
	int k=0;
	scanf("%d\n",&n);
	gets(a);
	int s;
	s=strlen(a);
	for(i=0;i<s-n+1;i++)
	{
		for(j=0;j<n;j++)
			b[k][j]=a[i+j];
		k++;
	}
	for(i=0;i<k;i++)
	  for(j=i;j<k;j++)
		  if(strcmp(b[i],b[j])==0)  
			  count[i]++;
	int max=0;
	for(i=0;i<k;i++)
		if(count[i]>=max)  max=count[i];
	if(max==1)printf("NO");
	else{
	printf("%d\n",max);
	for(i=0;i<k;i++)
	{if(count[i]==max) 
	puts(b[i]);
	}}
	return 0;
}
int main()
{
    char word[510],subword[510][6];
    int n,i,j,len,num[510]= {0},temp=0;
    cin>>n;
    cin.get();
    cin.getline(word,510);
    len=strlen(word);
    for(i=0; i<=len-n; i++)
    {
        for(j=0; j<n; j++)
        {
            subword[i][j]=word[i+j];
        }
        subword[i][n]='\0';
    }
    for(i=0; i<len-n; i++)
        for(j=i+1; j<=len-n; j++)
        {
            if(strcmp(subword[i],subword[j])==0 && num[i]>=0)
            {
                num[i]++;
                num[j]=-1;
            }

        }

    for(i=0; i<len-n; i++)
    {
        if(num[i]>temp)
            temp=num[i];
    }
    if(temp==0) cout<<"NO"<<endl;
    else
    {
        cout<<temp+1<<endl;
        for(i=0; i<len-n; i++)
        {
            if(num[i]==temp)
                cout<<subword[i]<<endl;
        }
    }
    return 0;
}
struct a
{
    char s[10];
    int num,del;
}list[500];
int n,len;
char s[1000];
int tot;
int max=-1;

void init()
{
    int i,j,k;
    scanf("%d\n",&n);
    len=strlen(gets(s));
    tot=len-n+1;
    for(i=0;i<tot;i++)
    {
        for(j=0;j<n;j++)
        {
            list[i].s[j]=s[i+j];
        }
        list[i].num=list[i].del=0;
        list[i].s[n]='\0';
    }
}

void solve()
{
    int i,j;
    for(i=0;i<tot;i++)
    {
        if(!list[i].del)
        {
            list[i].num=1;
            for(j=i+1;j<tot;j++)
            {
                if(!strcmp(list[i].s,list[j].s))
                {
                    list[i].num++;
                    list[j].del=1;
                }
            }
            if(list[i].num>max)
            {
                max=list[i].num;
            }
        }
    }
}

void print()
{
    int i;
    if(max-1)
    {
        printf("%d\n",max);
        for(i=0;i<tot;i++)
        {
            if(!list[i].del && list[i].num==max)
            {
                puts(list[i].s);
            }
        }
    }
    else    puts("NO");
}

int main()
{
    init();
    solve();
    print();
    return 0;
}
int n;
int check(char s[],int i,int j)
{
	int k,p=1;
	for(k=0;k<n;k=k+1)
		if (s[i+k]!=s[j+k])
		{
			p=0;
			break;
		}
	return p;
}
int main()
{
	int l,p,a[501]={0},i,j,max=0;
	char  s[501];
	scanf("%d\n",&n);
	gets(s);
	l=strlen(s);
	for(i=l-n-1;i>=0;i=i-1)
		for(j=i+1;j<=l-n;j=j+1)
		{
			p=check(s,i,j);
			if (p)
			{
				a[i]=a[j]+1;
				if (a[i]>max)
					max=a[i];
				break;
			}
		}
 if(max==0)  printf("NO");
 else
 {
	 p=0;
	 printf("%d\n",max+1);
	 for(i=0;i<l-n;i=i+1)
	 {
		 if (a[i]==max)
		 {
			 if(p) printf("\n");
			 p++;
			 for(j=0;j<n;j=j+1)
				 printf("%c",s[j+i]);
		 }
	 }
 }
 return 0;
}
int main()
{
	int n,i=0,j=0,k=0,h=0,l=0,m=0,ss=1;
	char x[500];
	scanf("%d",&n);
	getchar();
	gets(x);
	char xx[500][500];
	int b[500],s=-1;
	for(i=0;i<500;i++)
	{
		b[i]=0;
	}
	for(i=0;i<n;i++)
	{
		xx[j][k]=x[i];
		k++;
	}
	xx[j][k]='\0';
//	j++;
	k=0;
	for(i=0;x[i+n-1]!='\0';i++)
	{
		for(h=0;h<=j;h++)
		{	
			s=-1;
			for(l=0;l<n;l++)
			{
				ss=1;
				if(x[i+l]!=xx[h][l])
				{
					ss=0;
					goto end1;
				}
			}
end1:		if(ss==1)
			{
				s=h;
				goto end;
			}
		}
end:		if(s==-1)
		{
			j++;
			b[j]++;
			for(m=0;m<n;m++)
			{
				xx[j][m]=x[i+m];
			}
			xx[j][m]='\0';
		}
		else 
		{
			b[s]++;
		}
	}
	int max=b[0];
	for(i=0;i<=j;i++)
	{
		if(b[i]>=max)
		{
			max=b[i];
		}
//		printf("%s %d\n",xx[i],b[i]);
	}
	if(max==1)
	{
		printf("NO");
	}
	else
	{
		printf("%d\n",max);
		for(i=0;i<=j;i++)
		{
			if(b[i]==max)
			{
				printf("%s\n",xx[i]);
			}
		}
	}
	return 0;
}
int main()
{	int i,j,n,h,k;
	int c[500]={0};
	char a[500];
	char b[500][5];
	scanf("%d",&n);
	scanf("%s",a);
	for(i=0;i<strlen(a)-n+1;i++)
	{
		for(j=0;j<n;j++)
		{
			b[i][j]=a[i+j];
		}
	}
	for(i=0;i<strlen(a)-n+1;i++)
	{
		for(j=i+1;j<strlen(a)-n+1;j++)
		{
			h=1;
			for(k=0;k<n;k++)
			{
				if(b[i][k]!=b[j][k])
				{
					h=0;
					break;
				}
			}
				if(h==1)
					c[i]++;
			
		}
	}
	h=c[0];
	for(i=1;i<strlen(a)-n+1;i++)
	{
		if(h<c[i]) h=c[i];
	}
	if(h<=0) printf("NO");
	else
	{
		printf("%d\n",h+1);
	for(i=0;i<strlen(a)-n+1;i++)
	{
		if(h==c[i])
		{
			for(k=0;k<n;k++)
			{
				printf("%c",b[i][k]);
			}
			printf("\n");
		}
	}
	}
	return 0;
}
int main ()
{
	int n, i, cnt [505],len, j, k, num = 0, flag, max = 0;
	char a[506], b [508][6],c[6];
	char *p = a;
	cin >> n;
	cin >> a;
	len = strlen(a);
	for (i = 0; i<= 500; i++)
		cnt[i] = 0;
	for (i = 0;i <= len - n; i ++)
	{
		for (j = 0; j < n; j++)
			c[j] = *(p + i +j);
		c [n] = '\0';
		if (num == 0)
		{
			for (j = 0; j < n; j++)
			b[0][j] = c[j];
			b [0][n] = '\0';
			num ++;
		}
		else
		{
			flag = 1;
			for (j = 0; j <num; j ++)
			{
				if (strcmp (b[j], c)== 0)
					flag = 0;
			}
			if (flag == 1)
			{
				num ++;
				for (j = 0; j < n; j++)
					b[num - 1][j] = c[j];
				b[num - 1][n] = '\0';
			}
		}
	}
	for (i = 0; i < num ; i++)
	{
		for (j = 0;j <= len - n; j ++)
		{
			for (k = 0; k< n; k++)
				c [k] = *(p + j +k);
			c[n] = '\0';
			if (strcmp(b[i] ,c) == 0)
				cnt [i] ++;
		}
	}
	for (i = 0; i < num; i ++)
	{
		if (cnt [i] > max)
			max = cnt[i];
	}
	if (max > 1)
	{
		cout << max << endl;
		for (i = 0; i < num; i++)
		{
			if (cnt[i] == max)
				cout << b[i] << endl;
		}
	}
	else
		cout << "NO";
		return 0;
}
//
//  main.c
//  Track 80,n-gram????
//
//  Created by Charles.thRay.Lee on 2/1/13.
//  Copyright (c) 2013 Peking University. All rights reserved.
/*
 ??	??-From Whf
 ??
 ?????????n-gram??????????????n ?????????????????????????????????????????????n-gram ????? n ?????????????????????????????????????500????? 1 < n <5? ?????????????????????????????????????????????????1???? NO
 
 ???n=3???????abcdefabcd?
 ????? 3-gram??abc,bcd,cde,def,efa,fab,abc,bcd?????cd?????3-gram?????????abc ? bcd ????2?????????1?????????????
 2
 abc
 bcd
 ????
 ????n
 ???????
 ????
 ??????????????????
 ????
 3
 
 abcdefabcd
 
 ????
 2
 
 abc
 
 bcd
*/


int save(char point[5],char filed[400][5],int check[400],int filedp)
{
    int p=0,k=0;
    for (p=0; p<filedp&&k==0; p++) {
        if (strcmp(point, filed[p])==0)
        {
            check[p]++;
            k=1;
        }
    }
    if (k==0) {
        strcpy(filed[filedp], point);
        filedp++;
    }
    return filedp;
}

int main()
{
    int n,i=0,p=0,filedp=0,max=0;
    long len;
    char s[2000]={'\0'};
    char point[5]={'\0'};
    char filed[400][5]={'\0'};
    int check[400]={0};
    scanf("%d",&n);
    scanf("%s",s);
    
    len=strlen(s);
    for (i=0; i<=len-n; i++) {
        for (p=0; p<n; p++) {
            point[p]=s[p+i];
        }
        filedp=save(point,filed,check,filedp);
    }
    
    for (p=0; p<filedp; p++) {
        if (check[p]>=max) {
            max=check[p];
        }
    }
    
    if (max==0) {
        printf("NO");
    }
    else
    {
        printf("%d\n",max+1);
        
        for (p=0; p<filedp; p++) {
            if (check[p]==max) {
                printf("%s\n",filed[p]);
            }
        }
    }
    
}
main()
{
      int n,r,i;
      char s[501];
      char a[500][6];
      int b[500];
      for(i=0;i<500;i++)
      b[i]=1;
      scanf("%d",&n);
      scanf("%s",s);
      int x,j;
      int k=-1;
      x=strlen(s);
      for(i=0;i<=x-n;i++)
      {
                   k++;      
                  for(j=i;j<i+n;j++)
                    a[k][j-i]=s[j];
      }     
         for(i=0;i<k;i++)
         {
                         x=strlen(a[i]);
                         if(x>n)
                         continue;
                      for(j=i+1;j<=k;j++)
                      {
                                      for(r=0;r<n;r++)
                                      {
                                                      if(a[i][r]!=a[j][r])
                                                      break;
                                      }
                                      if(r==n)
                                      {
                                      b[i]++;
                                      a[j][n]='0';
                                      }
                      }
         }
          int p;
          p=b[0];
          for(i=1;i<=k;i++)
          {
                           if(b[i]>p)
                           p=b[i];
          }        
          if(p==1)
          printf("NO");
          else
          {
              printf("%d\n",p);
              for(i=0;i<=k;i++)
              {
                               if(b[i]==p)
                               printf("%s\n",a[i]);
              }
          }
          
                                 
      
      
}
int main()
{
    int n,x,k=0;
    int flag[550]={0};
    int t,j=1,i=0,max;
    char s[550];
    char s1[550][6]={0};//?x? 
    scanf("%d",&n);//n?gram??? 
    scanf("%s",s);
    t=strlen(s);
    x=t-n+1;//x????????? 
    do
    {
    *(*(s1+j)+k)=*(s+i);
    i++;
    k++;
    if(k==n)
    {
    i=j;
    j++;
    k=0;
    }
    }while(j<=x);
    for(i=1;i<=x-1;i++)
    {
                       for(j=i+1;j<=x;j++)
                       {
                       if(strcmp(*(s1+i),*(s1+j))==0)
                       flag[i]++;                                          
                       }
    }
      max=*(flag+1);
    for(i=2;i<=x;i++)
    {
                     if(*(flag+i)>max)
                     max=*(flag+i);
    
    }
    if(max==0)
    printf("NO");
    else
    {
    printf("%d\n",max+1);
    for(i=1;i<=x;i++)
    {
                     if(flag[i]==max)
                     printf("%s\n",*(s1+i));
    }
     }
    return 0;
}
char strin[503]={0},str2[10]={0};
int jilu[500]={0},used[500]={0};
int main()
{
	int i,j,len,k,n,pd=0,maxtime=0;
	cin>>n;
	getchar();
	cin.getline(strin,500);
	len=strlen(strin);
	for(i=0;i<=len-n;i++)
	{
		for(j=0;j<n;j++) str2[j]=strin[i+j];
		for(k=0;k<=len-n;k++)
		{
			if(used[k]==1) continue;
			pd=1;
			for(j=0;j<n;j++) 
			{
				if(strin[k+j]!=str2[j])pd=0;
			}
			if (pd==1) 
			{
				jilu[i]++;
				used[k]=1;
			} 
		}
		maxtime=(maxtime>jilu[i])?maxtime:jilu[i];
	}
	if(maxtime==1)cout<<"NO";
	else
	{
		cout<<maxtime<<endl;
		for(i=0;i<=len-n;i++)
		{
			if(jilu[i]==maxtime)
			{
				for(j=0;j<n;j++)cout<<strin[i+j];
				cout<<endl;
				
			}
		}
	}
	return 0;
}
void main()
{
	int m,n,i,j,p;
	char s[501],a[500][5];
	int c[500];
	scanf("%d\n",&n);
	gets(s);
	m=0;p=0;
	while(s[p]!='\0')
	{p++;}
    for(i=0;i<500;i++)
	{
		for(j=0;j<5;j++)
			a[i][j]=0;
	}
	for(i=0;i<p-n+1;i++)
	{
       for(j=i;j<i+n;j++)
		   a[i][j-i]=s[j];
	}
for(i=0;i<500;i++)
		c[i]=0;
	for(i=0;i<p-n-1;i++)
	{
		for(j=i;j<p-n+1;j++)
		{
			if(strcmp(a[j],a[i])==0)
            c[i]++;
        }
	}
	for(i=0;i<p-n;i++)
	{
		
		if(c[i]>m)
			m=c[i];
	}
	if(m==1)
		printf("NO");
	else
	{
		printf("%d\n",m);
	for(i=0;i<p-n;i++)
	{
		if(c[i]==m)
			printf("%s\n",a[i]);
	}
	}

}