char str[500], huiwen[500];
void main()
{
	int i, j, m, leng;
	int f(int, int);
	scanf("%s",str);
	for(leng=2; leng<strlen(str); leng++)
	{
		for(i=0; i<strlen(str); i++)
		{
			if(f(i, i+leng-1)==1) printf("%s\n",huiwen);
		}
	}
	/*for(i=0; i<strlen(str); i++)
	{
		for(j=i+1; j<strlen(str); j++)
		{
			if (f(i, j)==1) printf("%s\n",huiwen);
			for(m=0; m<=500; m++) huiwen[m]='\0';
		}
	}*/
}
int f(int i, int j)
{
	int flag=0, k=0;
	char s1[500], s2[500];
	for(k=0; k<=j-i; k++)
	{
		s1[k]=str[i+k];
		s2[k]=str[j-k];
		if(s1[k]==s2[k]) flag=flag;
		else flag=flag+1;
	}
	if(flag==0)
	{
		for(k=0; k<=j-i; k++)
		{
			huiwen[k]=s1[k];
		}
		return 1;
	}
	else return 0;
}


void srev(char str[500], int len)
{
	char rev[500];
	int i;
	for (i=0; i<len; i++)
		*(rev+i)=*(str+len-i-1);
	for (i=0; i<len; i++)
		*(str+i)=*(rev+i);
}
int main ()
{
	char s[500], str[500], rev[500];
	gets(s);
	int len=strlen(s), i, j;
	for (i=2; i<len; i++) {
		for (j=0; j<len-i+1; j++) {
			strncpy(str, s+j, i);
			strncpy(rev, s+j, i);
			str[i]=rev[i]='\0';
			srev(rev, i);
			if (strcmp(str, rev)==0) {
				puts(str);
			}
		}
	}
	return 0;
}


char s[510];
int num=0;
int k=0;
int len;
struct Str{
	int start,end;
	int len;
	}str[30010];
void run(){
	int a=k;
	int b=num;
	k=num;
	int k1,k2;
	for(int i=a;i<b;i++){
		k1= str[i].start-1;
		k2= str[i].end+1;
		if(k1>=0&&k2<len&&s[k1]==s[k2]){
			str[num].start=k1;
			str[num].end=k2;
			str[num++].len=k2-k1;
			}
		}
	}
int main(){
	cin>>s;
	len = strlen(s);
	//???????
	for(int i=0;i<len-1;i++){
		if(s[i]==s[i+1]){
			str[num].start = i;
			str[num].end = i+1;
			str[num++].len = str[i].start-str[i].end;
			}
		}
	k=0;
	//?????????????????????????
	while(k<num) run();
	for(int i=0;i<num;i++){
		for(int j=str[i].start;j<=str[i].end;j++){
			printf("%c",s[j]);
			}
		printf("\n");
		}
	return 0;
	}


int main()
{
	char str[500];
	cin >> str;
	int len, i, j, k, flag, count,start, end;
	len = strlen(str);
	for (i = 2; i <= len - 1; i++)      // i???????????
	{
		for (j = 0; j <= len - i; j++)  // j???????????,len - i???????????
		{
			flag = 0;
			count = j;
			for (k = j + i - 1; k >= count; count++, k--)  // ?k = j?
			{
				flag = 0;
				if (str[count] == str[k])
				{
					flag = 1;      // ????????
				}
				else
				{
					flag = 0;
					break;
				}
                // ??i??????????????i?????????k???count?count + 1
				if ((flag == 1) && ((k == count) || (k == count + 1)))
				{
					for (start = j; start <= j + i - 1; start++)
					{
						cout << str[start];
						if (start == j + i - 1)
						{
							cout << endl;
						}  // end for
					}  // end for
				} // end if
			} // end for k
		} // end for j
	} // end for i
	return 0;
}


void pd(char *p,int m)
{
	char *head,*end,*t,*q;
	head=p;
	int zhi=0,j;
	end=p+m-1;
   for(t=head,q=end;t<=end;t++,q--)
	{if(*t==*q)zhi=1;
     else{zhi=0;break;}}
	if(zhi==1)
	{for(t=head;t<=end;t++)
		printf("%c",*t);
	printf("\n");}
}
void main()
{
	char a[1000]={0};
    char *p;
	int n,i;
	gets(a);
	for(p=a,n=0;*p!='\0';p++,n++);
   for(i=2;i<=n;i++)
			for(p=a;p<a+n-i+1;p++)
			pd(p,i);
}


char str[500];
int length;
int check(int start,int len);
int ctr1,ctr2,ctr3;
int main(void)
{
	gets(str);
	length=strlen(str);
	for(ctr1=2;ctr1<=length;ctr1+=2)
	{
		for(ctr2=0;ctr2<=length-ctr1;ctr2++)
		{
			check(ctr2,ctr1);
		}
	}
	return 0;
}
int check(int start,int len)
{
	char a[500];
	char b[500];
	int i;
    for(i=0;i<500;i++)
	{
		a[i]='\0';
		b[i]='\0';
	}
	for(i=0;i<len;i++)
	{
		a[i]=str[i+start];
		b[i]=str[len-i+start-1];
	}
	if(strcmp(a,b)==0)
	{
		puts(a);
		return 1;
	}
	else
		return 0;
}


/*
 * file    homework 9_5
 * author  ??
 * date    2010-11-24
 * description
           ???????????????????
*/

int isHuiwen(char hw[])
{
	int len, i;
	len = strlen(hw);
	for (i = 0; i <= (len - 1) / 2; i ++)
		if (hw[i] != hw[len - 1 - i])
			break;
	if (i > (len - 1) / 2)
		return 1;
	else
		return 0;
}

int main()
{
	char str[501], hw[501];
	int i, j, len;
	cin >> str;
	len = strlen(str);
	for (i = 2; i <= len; i ++)                           // i????????
		for (j = 0; j <= len - i; j ++)
		{
			strncpy(hw, str + j, i);
			hw[i] = '\0';
			if (isHuiwen(hw))
				cout << hw << endl;
		}

	return 0;
}


/*
???:Huiwen()
??:???????????,?????1,????0
**/
int Huiwen(char part[])
{
	char check[501];
	memset(check, 0, sizeof(check));
	int i, j, len;
	len = strlen(part);
	j = len - 1;
	for (i = 0; i < len; i++)
		check[j--] = part[i];
	check[len] = '\0';
	return (!(strcmp(part, check)));
}

int main()
{
	char input[501];
	char part[501];
	cin.getline(input, 500);
	int i, j, k, t, len, n;
	len = strlen(input);
	for (n = 2; n <= len; n++)
	{
		for (i = 0; i <= len - n; i++)
		{
			memset(part, 0, 501);
			part[0] = input[i];
			k = 1;
			for (j = i + 1; j < i + n; j++)
				part[k++] = input[j];
			part[k] = '\0';
			if (Huiwen(part))
			{
				for (t = 0; t < k; t++)
					cout << part[t];
				cout << endl;
			}
		}
	}
	return 0;
}


int main()
{
   char a[500];
   cin.getline(a,500,'\n');
   int b=strlen(a);
   int wide=2;
   while(1)
   {
   for(int i=0;i<b-1;i++)
     {
       if(a[i]==a[i+1])
         {
           if(i+1-i+1==wide)
            cout<<a[i]<<a[i+1]<<endl;
            int m=i,n=i+1;
            while(1)
            {
               m--;
               n++;
               if(a[m]==a[n])
                {
                  if(n-m+1==wide)
                  for(int k=m;k<=n;k++)
                    cout<<a[k];
                  cout<<endl;
                }
               else
                break;
             }
          }
      }
    wide+=2;
    if(wide==b+2)
    break;
  }

 return 0;
 }


int main(){
	char a[501];
	int k;
	cin.getline(a,501);
	for(int i=1;i<=strlen(a);i++)
		for(int j=0;j<=(strlen(a)-i);j++){
			for(k=0;k<=i/2;k++){
				if(a[j+k]!=a[j+i-k])break;
			}
			if(k==(i/2+1)){
				for(int l=j;l<=j+i;l++)
					cout<<a[l];
				cout<<endl;
			}
		}
	return 0;
}


int f(char(num[]));
int main()
{
	int len , i , j , k;
	char str[500] , real[500];
	cin >> str ;
	len = strlen(str) ;
	for(i = 2 ; i <= len ; i++)
		for (j = 0 ; j < len - i + 1 ; j++)
			{
				for (k = 0 ; k < i ; k++)
					real[k] = str[j + k] ;
				real[i] = '\0' ;
				if (f(real))	cout << real << endl ;
			}
	return 0 ;
}
int f(char(num[]))
{
	int len , i;
	char another[500];
	len = strlen(num);
	for(i = 0 ; i < len ; i++)
		another[i] = num[len -1 -i] ;
	another[len] = '\0' ;
	if (strcmp(another,num) == 0)	return 1 ;
	else return 0 ;
}


void main()
{
	char a[505];
	int i,j,k,count;
	gets(a);

	for(i=2;i<=strlen(a);i++)
		for(j=0;(j+i)<=strlen(a);j++)
		{
			count=0;
			for(k=0;k<(i/2);k++)
				if(a[j+k]==a[j+i-1-k]) count++;
			if(count==i/2)
			{
				for(k=j;k<j+i;k++)
					printf("%c",a[k]);
				printf("\n");
			}
		}
}


int main()
{
    char a[500];
    char b[500];
    int len,i,j,k,judge;
    fgets(a,500,stdin);
    len=strlen(a)-1;
    for(i=0;i<len;i++)
        b[len-1-i]=a[i];
    for(i=2;i<=len;i++)
        for(j=0;j<=len-i;j++)
        {
            judge=0;
            for(k=0;k<=i-1;k++)
            {
                judge=judge+(a[j+k]-b[len-i-j+k])*(a[j+k]-b[len-i-j+k]);
            }
            if(judge==0)
            {
                for(k=0;k<=i-1;k++)
                    printf("%c",a[j+k]);
                printf("\n");
            }
        }

    return 0;
}


int main()
{
	char s[501];
	gets(s);
	int i,p,q,l,n,j;
	n=strlen(s);
	for(l=1;l<n;l++)
		for(i=0;i<n-l;i++)
		{
			p=i;
			q=i+l;
			while(s[p]==s[q]&&p<q)
			{
				p++;
				q--;
			}
			if(q<=p)
			{
				for(j=i;j<=i+l;j++)
					printf("%c",s[j]);
				printf("\n");
			}
		}
		return 0;
}


int main()
{
	char str[505] = {0};
	cin >> str;
	int length = strlen(str);
	for (int l = 2 ; l <= length ; l++)
	{
		for (int i = 0; i <= length - l; i ++)
		{
			if (str[i] == str[i + l - 1])
			{
				int m = i + 1, n = i + l - 2;
				for (; m <= n ; m ++, n--)
				{
					if (str[m] != str[n])
						break;
				}
				if (m > n)
				{
					for (int m = i ; m <= i + l - 1; m++)
						cout << str[m];
					cout << endl;
				}
			}
		}
	}
	cin.get();
	cin.get();
	return 0;
}


//????
//2010?11?24?
//1000012753 ???
char str[1000];
int cycle(int a, int b)
{
	while (b >= 0)
	{
		if (str[a] == str[a + b - 1])
		{
			a++;
			b -= 2;
		}
		else
			return 1;
	}
	return 0;
}

int main()
{
	int i, j, k, l;
	cin >> str;
	l = strlen(str);
	for (i = 2; i <= l; i++)
		for (j = 0; j <= l - i; j++)
			if (cycle (j, i) == 0)
			{
				for (k = j; k < j + i; k++)
					cout << str[k];
				cout << endl;
			}
	return 0;
}


char a[100],sub[1000][100];
int l,sublen,cnt=0;
void jud(char t[100])
{
	int i,j,k;
	char s1[50],s2[50];
	memset(s1,'\0',sizeof(s1));
	memset(s2,'\0',sizeof(s2));
	if (strlen(t)%2==1)
	{
		for (i=strlen(t)/2-1;i>=0;i--)
		{
			s1[strlen(t)/2-1-i]=t[i];
		}
		for (i=strlen(t)/2+1;i<strlen(t);i++)
		{
			s2[i-strlen(t)/2-1]=t[i];
		}
	}
	else
	{
		for (i=strlen(t)/2-1;i>=0;i--)
		{
			s1[strlen(t)/2-1-i]=t[i];
		}
		for (i=strlen(t)/2;i<strlen(t);i++)
		{
			s2[i-strlen(t)/2]=t[i];
		}
	}
	for (i=1;i<=cnt;i++)
	{
		if (strcmp(sub[i],t)==0||strlen(t)==1)
			break;
		else
		{
			if (strcmp(s1,s2)==0)
				cout<<t<<endl;
			break;
		}
	}
}
void fen(int sl)
{
	int i,j;
	for (i=0;i<=l-sl;i++)
	{
		cnt++;
		for (j=0;j<sl;j++)
		{
			sub[cnt][j]=a[i+j];
		}
	}
}
void d()
{
	int i;
	l=strlen(a);
	memset(sub,'\0',sizeof(sub));
	for (sublen=2;sublen<=l;sublen++)
	{
		fen(sublen);
	}
	for (i=1;i<=cnt;i++)
	{
		jud(sub[i]);
	}
}
int main()
{
	cin>>a;
	d();
	return 0;
}


int main()
{
	char c[505]={0};
	cin.getline(c,505,'\n');
	int num,i,j,k,standard,sum=0,q;
	for(num=0;;num++)
	{
		if(c[num]=='\0')
			break;
	}

	for(i=2;i<=num;i++)              //??????
	{
		for(k=0;k<=num-i;k++)       //?a[0]???a[num-i]
		{
			sum=0;
			for(j=k;j<=k+i-1;j++)
			{

				if(c[j]==c[2*k+i-1-j])
					standard=1;
				else
					standard=0;
				sum=sum+standard;

			}

			if(sum==i)
			{
				for(q=k;q<k+i-1;q++)
					cout<<c[q];

				cout<<c[k+i-1]<<endl;
			}

		}

	}

	return 0;

}


int main()
{
  char str[500];
  cin>>str;
  int i;
  int size=strlen(str);
  for(i=1;i<size;i++)
  {
       int h,t;
       for(h=0;h<size-i;h++)
       {
         int h1=h;
         t=h+i;
         int m;
         for(;h1<t;h1++,t--)
         if(str[h1]!=str[t])
         break;
         if(h1>t)
         {
         for(m=h;m<=h+i;m++)
         cout<<str[m];
         cout<<endl;
         }
       }
  }
  cin.get();cin.get();cin.get();
  return 0;
}


int main ()
{
	char str[501];
	cin >> str;
	int len = strlen(str);
	int i=0, n=0, m=0, k=0, j=0,flag=0;
	for (i = 2; i <= len; i++)
	{
		for (j = 0; j <= len - i; j++)
		{
			for (n = j, m = i + j - 1; n < m; n++, m--)
			{
				flag = 1;
				if (str[n] != str[m])
				{
					flag = 0;
					break;
				}
			}
			if (flag)
			{
				for (k = j; k <= i + j - 1; k++)
					cout << str[k];
				cout << endl;
			}
		}
	}
	return 0;
}


void find (char target[])//??
{
	int count = 0;
	int i,j,k;
	int flag;
	char change[500];
	for (i = 0;i <= 500;i++)//????????
	{
		if (target[i] != '\0')
			count++;
		else
			break;
	}
	for (i = 2;i <= count;i++)//??????
	{
		for (j = 0;j <= count - i;j++)//????????
		{
			flag = 1;
			for (k = j;k <= j + i - 1;k++)
				change[k] = target[k];
			for (k = 0;k <= i / 2 - 1;k++)//???????????
			{
				change[j + k] = target[j + i - 1 - k];
				change[j + i - 1 - k] = target[j + k];
			}
			for (k = 0;k < i - 1;k++)
			{
				if (change[j + k] != target[j + k])
					flag = 0;
			}
			if (flag == 1)//?????????????
			{
				for (k = j;k <= j + i - 1;k++)
					cout<<target[k];
				cout<<endl;
			}
		}
	}
}

int main()
{
	char target[500];
	cin.getline(target,500);
	find(target);
	return 0;
}


char f1(char ch[],int left,int right)
{
    if(left >= right)
	{
		return 1;
	}
	else if(ch[left] != ch[right])
	{
		return 0;
	}
	else
	{
		return f1(ch, left+1, right-1);
	}
}
char f2(char ch[],int start,int end)
{
    while(start<=end)
	{
		putchar(ch[start++]);
	}
    putchar('\n');
	return '0';
}
main()
{
	char ch[500];
	int i,l,w;
	gets(ch);
	l=strlen(ch);
	for(w=1;w<=l;w++)
	{
		for(i=0;i<l-w;i++)
		{
			if(f1(ch,i,i+w))
				f2(ch,i,i+w);
		}
	}
	return 0;
}


/*
 * draft2.cpp
 *
 *  Created on: 2014-1-4
 *      Author: Mac
 */

char a[600], b[100], b1[100], *p;

int main()
{
	cin >> a;
	for(int len = 1; len < strlen(a); len++)
		for(int i = 0; i < strlen(a) - len; i++)
			{
			int j = 0;
			for(j = 0; j <= len/2; j++)
				{
				if(a[i+j] != a[i+len-j])
					break;
				}
			if (j == len/2 + 1)
				{
				for(int t = 0; t <= len; t++ )
					cout << a[i+t];
				cout << endl;
				}

			}
}


char s[500];

int substr(char s[], int start, int end)
{
	while ((end>start)&&(s[start]==s[end]))
	{
		start++; end--;
	}
	if(end>start)
		return 0;
	else
		return 1;
}

void osubstr(char s[], int start, int end)
{
	int i;
	for(i=start;i<=end;i++)
		putchar(s[i]);
	putchar('\n');
}

int main()
{
	unsigned int m,n,width;
	gets(s);
	for(width=1; width<strlen(s); width++)
	    for(m=0; m<=strlen(s)-width;m++)
		    if(substr(s, m, m+width))
			    osubstr(s, m, m+width);
}


int main()
{
	char str[502];
	cin >> str;
	int i,j,len1,len2;
	len1 = strlen(str);
	for(len2 = 2; len2 < len1; len2++)
	{
		for(i = 0; i < len1; i++)
		{
			for(j = i; j < i + len2; j++)
			{
				if(str[j] != str[2 * i + len2 - 1 - j])
					break;
			}
			if(j == i + len2)
			{
				for(j = i; j < i + len2; j++)
					cout << str[j];
				cout << endl;
			}
		}
	}
	return 0;
}


int main()
{
	void isHuiwen(char s0[500], int i);
	char str[500];
	char s0[500];
	int i, j, k, l;
	gets(str);
	l = strlen(str);
	for (i = 2;i < l;i++)
	{
		for(j = 0;j <= l - i;j++)
		{
			for(k = 0;k <= i;k++)
				s0[k] = str[k + j];
			isHuiwen(s0, i);
		}
	}
	return 0;
}
void isHuiwen(char s0[500], int i)
{
	int p;
	for(p = 0;p <= i/2;p++)
	{
		if(s0[p] != s0[i - 1 -p])
		return;
	}
	for(p = 0;p < i;p++)
		printf("%c",s0[p]);
	printf("\n");
	return;
}


char str[510];
int flag[510]={0};
int check( int head, int n )
{
    if(n==0)
        return 1;
    if(n==-1)
        return 1;
    if(str[head]==str[head+n])
    {
        return check(head+1,n-2);
    }
    else return 0;
}
int main()
{
    int len, i, m=1, k;
    cin.getline( str , 500 );
    len = strlen(str);
    for(m=1; m<len; m++)
    {
        for(i=0; i<=len-m; i++)
        {
            if(check(i,m)==1)
            {
                for(k=i;k<=i+m;k++)
                {
                    cout<<str[k];
                }
                cout<<endl;
            }
        }
    }
    return 0;
}


int main()
{
    char str[500];
    cin >> str;
    int l = strlen(str), i, j, m = 1, count = 0;
    for (m = 1; m < l; m++)
    {
        for (i = 0; i < l - m; i++)
        {
            count = 0;
            for (j = 0; j <= m / 2 + 1; j++)
            {
                if (str[i + j] != str[i + m - j])
                    continue;
                else
                    count++;
            }
            if (count >= j)
            {
                for (j = i; j <= i + m; j++)
                    cout << str[j];
                cout << endl;
            }
        }
    }
    return 0;
}


//????
int main()
{
	char a[500];
	int i = 0, j = 0, k = 0;
	cin >> a;
	int l = strlen(a);
	for (i = 2; i <= l; i++)
	{
		for (j = 0; j <= l - i; j++)
		{
			int flag = 1;
			for (k = j; k < j + i; k++)
			{
				if (a[k] != a[j + i + j - k - 1])
				{
					flag = 0;
					break;
				}
			}
			if (flag)
			{
			for (k = j; k < i + j; k++)
			{
				cout << a[k];
			}
			cout << endl;
			}
		}
	}
	return 0;
}


int main()
{
	char a[501];
	int i,k,len,l;
	gets(a);
	l=strlen(a);
	for(len=2;len<=l;len++)
	{
		for(i=0;i<=l-len;i++)
		{
			if(a[i]==a[i+len-1])
			{
				for(k=1;k<=len/2;k++)
				{
					if(a[k+i]!=a[i+len-1-k])
						break;
				}
				if(k>len/2)
				{
					for(k=i;k<i+len;k++)
						printf("%c",a[k]);
					printf("\n");
				}
			}
		}
	}
	return 0;
}


//
//  main.cpp
//  hw
//
//  Created by ? ? on 12-12-16.
//  Copyright (c) 2012? ? ?. All rights reserved.
//

int D(int month)
{
    if (month==1||month==3||month==5||month==7||month==8||month==10||month==12) {
        return 31;
    }
    if (month==4||month==6||month==9||month==11) {
        return 30;
    }
    if (month==2) {
        return 28;
    }
}

int main(int argc, const char * argv[])
{
    int x[7]={5,4,3,2,1,0,6};
    int w,month=1,days=13;
    cin>>w;
    while (month<=12) {
        int y=days%7;
        if (y==x[w-1]) {
            cout<<month<<endl;
        }
        days+=D(month);
        month++;
    }
    return 0;
}


int main()
{
	int w = 0;
	int month = 0;
	int day = 12;
	scanf("%d", &w);
	for (month = 0; month <= 11; month ++)
	{
		if ((day % 7 + w) % 7 == 5)
			printf("%d\n", month + 1);
		if (month == 3 || month == 5 || month == 8 || month == 10)
			day += 30;
		else
		{
			if (month == 1)
				day += 28;
			else
				day += 31;
		}
	}
	return 0;
}


int main()
{
	int xingqi,yue,zong=0,panduan;
	scanf("%d",&xingqi);
	for(yue=1;yue<13;yue++){
		panduan=(zong+12)%7+xingqi;
		if(panduan>7)
			panduan=panduan-7;
		if(panduan==5)
			printf("%d\n",yue);
		if(yue==1||yue==3||yue==5||yue==7||yue==8||yue==10||yue==12)
			zong=zong+31;
		else if(yue==4||yue==6||yue==9||yue==11)
			zong=zong+30;
		else if(yue==2)
			zong=zong+28;
	}
	return 0;
}


void main()
{
	int mon,day,i,sumday,a,b;//
	scanf("%d",&day);
	for(mon=1;mon<=12;mon++)
	{
		switch(mon)
		{
			case 1:sumday=12;break;
			case 2:sumday=31+12;break;
			case 3:sumday=59+12;break;
			case 4:sumday=90+12;break;
			case 5:sumday=120+12;break;
			case 6:sumday=151+12;break;
			case 7:sumday=181+12;break;
			case 8:sumday=212+12;break;
			case 9:sumday=243+12;break;
			case 10:sumday=273+12;break;
			case 11:sumday=304+12;break;
			case 12:sumday=334+12;break;
		}

		a=sumday%7;
		b=day+a;
		if(b>7){b=b-7;}

		if(b==5)printf("%d\n",mon);
	}
}


int main()
{
	int initialday,month;
	scanf("%d",&initialday);
	for(month=1;month<=12;month++)
	{
		switch(month)
		{
			case 1:
				if((initialday+7)%7==0)
					printf("1\n");
				break;
			case 2:
				if((initialday+38)%7==0)
					printf("2\n");
				break;
			case 3:
				if((initialday+66)%7==0)
					printf("3\n");
				break;
			case 4:
				if((initialday+97)%7==0)
					printf("4\n");
				break;
			case 5:
				if((initialday+127)%7==0)
					printf("5\n");
				break;
			case 6:
				if((initialday+158)%7==0)
					printf("6\n");
				break;
			case 7:
				if((initialday+188)%7==0)
					printf("7\n");
				break;
			case 8:
				if((initialday+219)%7==0)
					printf("8\n");
				break;
			case 9:
				if((initialday+250)%7==0)
					printf("9\n");
				break;
			case 10:
				if((initialday+280)%7==0)
					printf("10\n");
				break;
			case 11:
				if((initialday+311)%7==0)
					printf("11\n");
				break;
			case 12:
				if((initialday+341)%7==0)
					printf("12\n");
				break;
		}
	}

	return 0;
}


int main()
{
	int w,i;
	scanf("%d",&w);
	for(i=1;i<13;i++)
	{
		switch(i)
		{
		case 1:w+=12;break;
		case 2:w+=31;break;
		case 3:w+=28;break;
		case 4:w+=31;break;
		case 5:w+=30;break;
		case 6:w+=31;break;
		case 7:w+=30;break;
        case 8:w+=31;break;
        case 9:w+=31;break;
        case 10:w+=30;break;
        case 11:w+=31;break;
        case 12:w+=30;break;
		}
		if(w%7==5)printf("%d\n",i);
	}
	return 0;
}


int main( )
{
	int day,mon,i,sum,xingqiji;
	cin >> day;
	sum = day + 12;
	for ( mon = 1; mon <= 12; mon++)
	{
		switch(mon)
		{
			case 1 : i = 0; break;
			case 2 :
			case 4 :
			case 6 :
			case 8 :
			case 9 :
			case 11 : i = 31; break;
			case 3 : i = 28; break;
			case 5 :
			case 7 :
			case 10 :
			case 12 : i = 30; break;
		}
		sum = sum + i;
		xingqiji = sum % 7;
		if ( xingqiji == 5 ) cout << mon << endl;
	}
	return 0;
}


void main()
{
	int w;
	char c;
   scanf("%d",&w);
	for(;(c=getchar())!=EOF;)
	{
		scanf("%d",&w);
		if(w==1)printf("4\n7");
		else if(w==2)printf("9\n12");
		else if(w==3)printf("6");
		else if(w==4)printf("2\n3\n11");
		else if(w==5)printf("8");
		else if(w==6)printf("5");
		else if(w==7)printf("1\n10");
		printf("\n");
	}
}


int main()
{
	int day,month;
	scanf("%d",&day);day+=12;
	for(month=1;month<=12;month++)
	{
		switch(month-1)
		{
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
	    case 12:day+=31;break;
		case 2: day+=28;break;
	    case 0:break;
	    default: day+=30;break;
		}
		if(day%7==5) printf("%d\n",month);
	}
	return 0;
}


int main()
{
	int w,m,x,sd=13,p,d,i;
	scanf("%d",&w);
	for(m=1;m<=12;m++)
	{
		for(i=1;i<=m;i++)
		{
			switch(i)
			{
				case 1:
				p=0;
				break;	case 2:
				p=31;
				break;	case 3:
				p=28;
				break;	case 4:
				p=31;
				break;	case 5:
				p=30;
				break;	case 6:
				p=31;
				break;	case 7:
				p=30;
				break;	case 8:
				p=31;
				break;	case 9:
				p=31;
				break;	case 10:
				p=30;
				break;	case 11:
				p=31;
				break;	case 12:
				p=30;
			}

		}sd=sd+p;
		d=sd%7;
		x=(d+w-1)%7;
		if(x==5)
			printf("%d\n",m);
	}
	return 0;
}


int check(int a)
{
    if(a>7)
    return a-7;
    else
    return a;

}
int main()
{
    int n;
    scanf("%d",&n);
    int m[12];
    int i;
    m[0]=12%7+n;
    m[0]=check(m[0]);
    //printf("%d",m[0]);
    for(i=1;i<12;i++)
    {
        switch(i)
        {
        case 1:case 3:case 5:case 7:case 8:case 10:
        m[i]=31%7+m[i-1];
        break;
        case 2:
        m[i]=28%7+m[i-1];
        break;
        case 4:case 6:case 9:case 11:
        m[i]=30%7+m[i-1];
        }
        m[i]=check(m[i]);
    }
    for(i=1;i<=12;i++)
   if(m[i-1]==5)
    printf("%d\n",i);
}


struct form{
	int month;
	int day;
	int date;
}every[365];

void main(){
	int firstday,month=1,date=1,day;
	int monthday[12]={31,28,31,30,31,30,31,31,30,31,30,31};
	int i;
	scanf("%d",&firstday);
	day=firstday;
	for(i=0;i<365;i++){
		every[i].month=month;
		every[i].day=day;
		every[i].date=date;
		if(every[i].date==monthday[month-1]){
			month++;
			date=1;
		}else{
			date++;
		}
		if(every[i].day==7){
			day=1;
		}else{
			day++;
		}
	}
	for(i=0;i<365;i++){
		if(every[i].date==13&&every[i].day==5){
			printf("%d\n",every[i].month);
		}
	}
}


int main()
{
    int n;
    cin>>n;
    switch(n)
    {case 1:cout<<4<<endl<<7<<endl;break;
     case 2:cout<<9<<endl<<12<<endl;break;
     case 3:cout<<6<<endl;break;
     case 4:cout<<2<<endl<<3<<endl<<11<<endl;break;
     case 5:cout<<8<<endl;break;
     case 6:cout<<5<<endl;break;
     case 7:cout<<1<<endl<<10<<endl;break;
     }
    return 0;
}


int main()
{
	int w,firstfri,interval,i;
	scanf("%d",&w);
	if(w<=5)
		firstfri=6-w;
	else if(w>5) firstfri=13-w;
	interval=13-firstfri;
	for(i=1;i<=12;i++)
	{
		if(i==1) if(interval%7==0) printf("%d\n",i);
		if(i==2||i==4||i==6||i==8||i==9||i==11)
		{
			interval+=31;
			if(interval%7==0) printf("%d\n",i);
		}
		if(i==3)
		{
			interval+=28;
			if(interval%7==0)
				printf("%d\n",i);
		}
		if(i==5||i==7||i==10||i==12)
		{
			interval+=30;
			if(interval%7==0)
				printf("%d\n",i);
		}
	}
	return 0;
}


void main()
{
    int w,day,mon;
	int cal(int mon);
	scanf("%d",&w);
	for(mon=1;mon<13;mon++)
	{
	    day=cal(mon);
		if((day+w)%7==5)printf("%d\n",mon);
	}
}
int cal(int mon)
{
   int total=0;
   if(mon>1)total+=31;
   if(mon>2)total+=28;
   if(mon>3)total+=31;
   if(mon>4)total+=30;
   if(mon>5)total+=31;
   if(mon>6)total+=30;
   if(mon>7)total+=31;
   if(mon>8)total+=31;
   if(mon>9)total+=30;
   if(mon>10)total+=31;
   if(mon>11)total+=30;
   total=total+12;
   return(total);
}


int DiJiTian(int x);
int main (){
	int w,i,m,n,y;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
	   y=DiJiTian(i)-1;
	   m=y%7;
	   n=m+w;
	   if(n>7){
	     n=n-7;
	   }
	   if(n==5){
	       printf("%d\n",i);
	   }
	}

return 0;
}
int DiJiTian(int x){
  int result;
  int j;
  if(x==1){result=13;}
  else{
	  result=0;
	  for (j=1;j<x;j++){
		  if(j==1||j==3||j==5||j==7||j==8||j==10||j==12){
		      result+=31;
		  }
		  else if(j==4||j==6||j==9||j==11){
		      result+=30;
		  }
		  else if(j==2){
		      result+=28;
		  }
	  }
	  result+=13;
  }
  return result;
}


// ²»¼ªÀûÊý×Ö.cpp : Defines the entry point for the console application.
//
int main(int argc, char* argv[])
{
	int first,i,day=13;
	scanf("%d",&first);
	for(i=1;i<=12;i++){
		if(i==2||i==4||i==6||i==8||i==9||i==11){
			day+=31;
		}
		if(i==3)day+=28;
		if(i==5||i==7||i==10||i==12){
			day+=30;
		}
		if((day%7-1+first)%7==5)printf("%d\n",i);
	}
	return 0;
}


int main()
{
	int month[12];
	int w, days = 0, i, flag = 0;
	cin >> w;
	for (i = 1; i <= 12; i++)
	{
		switch(i)
		{
			case 3: days += 28; break;
			case 5:
			case 7:
			case 10:
			case 12: days += 30; break;
			case 2:
			case 4:
			case 6:
			case 8:
			case 9:
			case 11: days += 31; break;
		}
		month[i -1] = ((days + 12) % 7 + w) % 7;
		if (month[i - 1] == 5)
		{
			cout << i << endl;
		}
	}
	return 0;
}


int month(int n)
{
	int sum=0;
	int i;
	for(i=0;i<n;i++)
	{
		if(i==0)
			sum=sum+0;
		if(i==1||i==3||i==5||i==7||i==8||i==10||i==12)
		{
			sum=sum+31;
		}
		if(i==4||i==6||i==9||i==11)
		{
			sum=sum+30;
		}
		if(i==2)
		{
			sum=sum+28;
		}
	}
	return sum;
}

int fri(int n,int w)//n  month
{
	int days;
	days=month(n);
	days=days+13;
	int a;
	a=days%7;
	if(w+a>7)
	{
		return w+a-7-1;
	}else{
		return w+a-1;
	}
}

int main()
{
	int i;
	int w;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{
		int day;
		day=fri(i,w);
		if(day==5)
		{
			printf("%d\n",i);
		}
	}
	return 0;
}


int dayOfMonth(int month);

int main(){

	int w;

	scanf("%d", &w);

	for(int i = 1; i <= 12; i++){

		int	week = (w+12)%7;
		if(week == 5){
			printf("%d\n", i);
		}

		w = (w + dayOfMonth(i))%7;
	}

	return 0;
}

int dayOfMonth(int month){
	switch(month){
		case 1: return 31;
		case 2: return 28;
		case 3: return 31;
		case 4: return 30;
		case 5: return 31;
		case 6: return 30;
		case 7: return 31;
		case 8: return 31;
		case 9: return 30;
		case 10: return 31;
		case 11: return 30;
		default: return 31;
	}

}


void panduan(int i,int num);
int i, num;
main()
{
    int w;
    scanf("%d",&w);
    i=1;
    num=(13+w-1);
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+28;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
    num=num+31;
    panduan( i, num);i++;
    num=num+30;
    panduan( i, num);i++;
}

void panduan(int i,int num)
{

    if(num%7==5)
    {printf("%d\n",i);
    }
}


int date(int month);
int daycount(int month);

int main()
{
    int day=0;
    scanf("%d",&day);

	int remainder=0;
	if(day>5)
		remainder=12-day;
	if(day<5)
		remainder=5-day;
	int month=1;
	for(;month<=12;month++)
	{
		if(daycount(month)%7==remainder)
			printf("%d\n",month);
	}

	return 0;
}

int date(int month)
{
	switch(month)
	{
	   case 1: case 3: case 5: case 7: case 8: case 10: case 12:
	    	return 31;
		    break;
	   case 2:
	    	return 28;
		    break;
	   case 4: case 6: case 9: case 11:
	     	return 30;
		    break;
	}
}

int daycount(int month)
{
	if(month==1)
		return 12;
	int sum=12;
	int mon=1;
	for(;mon<month;mon++)
		sum+=date(mon);
	return sum;
}


int day(int mouth)
{
	int i;
	if(mouth==1 || mouth==3 || mouth==5 || mouth==7 || mouth==8 || mouth==10)
		i=31;
	else if(mouth==2)
		i=28;
	else if(mouth==0) i=0;
	else i=30;
	return(i);
}

int main()
{
	int i, w, date=0;
	scanf("%d", &w);
	w=13%7+w-1;
	if(w>7) w=w-7;
	for(i=0;i<12;i++)
	{
       w=day(i)%7+w;
       if(w>7) w=w-7;
	   if(w==5)
		  printf("%d\n", i+1);
	}
	return 0;
}


int LeapQ(int);
int DayCount(int, int, int);

int main()
{
	int i, n;
	scanf("%d", &n);
	for(i=1; i<=12; i++)
	{
		if((DayCount(1,i,13)-(6-n))%7==0) printf("%d\n", i);
	}
	return 0;
}

int LeapQ(int year)
{
	return (year%400==0||year%100!=0&&year%4==0)?1:0;
}

int DayCount(int year, int month, int date)
{
	int i, num=0;
	for(i=1; i<month; i++)
	{
		if(i==2) num+=LeapQ(year)?29:28;
		else num+=(i==1||i==3||i==5||i==7||i==8||i==10||i==12)?31:30;
	}
	num+=date;
	return num;
}


int month_len(int x)
{
	int day=31;
	if(x==0)day=0;
	if(x==2)day=28;
	if(x==4||x==6||x==9||x==11)day=30;
	return day;
}
int sum_days(int y)
{
	int ctr,sum=0;
	for(ctr=0;ctr<y;ctr++)
	{sum+=month_len(ctr);}
		sum+=12;
		return sum;
}
void main()
{
	int i,w;
	scanf("%d",&w);
	for(i=1;i<=12;i++)
	{if(sum_days(i)%7+w==5||sum_days(i)%7+w==12)printf("%d\n",i);}
}


int month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
struct Date
{
    int  iLab,iMonth,iDay;
} DNow;

void Date_Walk()
{
	for(int x=1;x<=12;x++)
	{
		for(int y=1;y<=month[x];y++)
		{
		    DNow.iLab++;
			if(DNow.iLab>7) DNow.iLab=1;
			if(y==13 && DNow.iLab==5) cout<<x<<endl;
		}
	}
	return;
}

int main()
{
	int w;
	cin>>w;
	DNow.iMonth=1,DNow.iDay=1,DNow.iLab=w-1;
	Date_Walk();
	return 0;
}


int main(int argc, char* argv[])
{
	int i,w,a,b,day,s=0;

	scanf("%d",&w);
	for(i=1;i<13;i++)
	{
		switch (i)
		{
		case 1:{
			day=0;
			break;}
		case 2:
		case 4:
		case 6:
		case 8:
		case 9:
		case 11:{
			day=31;
			break;}
		case 3:{
			day=28;
			break;}
		default:{
			day=30;
			break;}
		}
		s=s+day;
		a=12+s;
		b=a%7+w;
		if (b%7==5){
			printf("%d\n",i);}
	}

	return 0;
}


int start;
const int thirteen[12]={13,44,72,103,133,164,194,225,256,286,317,347};

inline int conv(int a){
    if(a==1) return 5;
    if(a==2) return 4;
    if(a==3) return 3;
    if(a==4) return 2;
    if(a==5) return 1;
    if(a==6) return 7;
    if(a==7) return 6;
};
int main(){
    cin>>start;
    for(int i=0;i<12;i++){
        if((thirteen[i]-conv(start))%7==0) cout<<i+1<<endl;
    };
    return 0;
}


int main()
{

    //??????
    int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

    //startDay?1?1??????
    //xMonthThirteenth????13??????????
    //whatDay????13??????
    int startDay, xMonthThirteenth = 13;
    int whatDay, i;

    scanf("%d", &startDay);
    xMonthThirteenth += (startDay - 1);
    for(i = 0; i < 12; i ++)
    {
        whatDay = xMonthThirteenth % 7;
        if(whatDay == 5)
            printf("%d\n", i + 1);
        xMonthThirteenth += days[i];
    }

	return 0;
}


int main()
{
	int w,i,sum=0;
	cin>>w;
	for (i=0;i<=11;i++)
	{
		switch (i)
		{
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:sum+=31;break;
		case 4:
		case 6:
		case 9:
		case 11:sum+=30;break;
		case 2:sum+=28;break;
		default:sum+=0;break;
		}
		if ((sum+13+w-1)%7==5)   cout<<i+1<<endl;
	}
    return 0;
}


int main()
{
	int w,i,j,flag;
	int day[12][31]={0};
	int date[366];
    scanf("%d",&w);
	for(i=0;i<365;i++)
	{
			if(w+i<8)
			date[i]=w+i-1;
	}
	for(flag=0;flag<365;flag++)
	{
		date[flag+8-w]=flag%7;
	}
	flag=0;
	for(i=0;i<12;i++)
	{
        for(j=0;j<31;j++)
		{
		    if(i==1&&j>27)
				continue;
			else if(i==3&&j>29)
				continue;
			else if(i==5&&j>29)
				continue;
			else if(i==8&&j>29)
				continue;
			else if(i==10&&j>29)
				continue;
			else day[i][j]=date[flag];
			flag++;
		}
	}
	for(i=0;i<12;i++)
	{
		for(j=0;j<31;j++)
		{
			if(j==12&&day[i][j]==4)
				printf("%d\n",i+1);

		}
	}
	getchar();getchar();
	return 0;
}


int main()
{
	int mon[12]={0,31,28,31,30,31,30,31,31,30,31,30};
	int imon[12]={0};
	int w;
	cin>>w;
	int i;
	int j = 0;
	int d,id=0;
	int s = 0;
	switch(w)
	{
		case 7:s = 5;break;
		case 6:s = 6;break;
		case 5:s = 0;break;
		case 4:s = 1;break;
		case 3:s = 2;break;
		case 2:s = 3;break;
		default:s = 4;break;
	}
	for(i = 0;i < 12;i++)
	{
		id += mon[i];
		d = id + 13 - 1;
		if((d % 7) == s)
		{
			imon[j]=i+1;
			j++;
		}
	}
	for(i=0;i<j;i++)
		cout<<imon[i]<<endl;
	return 0;
}


int main ()
{
    int w;
	cin >> w;
	switch (w % 7)
	{
	    case 0:cout << 1 << endl << 10;break;
		case 1:cout << 4 << endl << 7;break;
		case 2:cout << 9 << endl << 12;break;
		case 3:cout << 6;break;
		case 4:cout << 2 << endl << 3 << endl << 11;break;
		case 5:cout << 8;break;
		case 6:cout << 5;break;
	}
    return 0;
}


int date(int);
int main()
{
	int w, W;
	cin >> w;
	if(w <= 5)
		W = 5 - w;
	else
		W = 12 - w;
	for(int j = 1; j <= 12; j++)
	{
		if(date(j) % 7 == W)
			cout << j << endl;
	}
	return 0;
}
int date(int cf)
{
	int sum, month[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
	if(cf == 1)
		sum = 12;
	else
	{
		sum = 43;
		for(int i = 2; i < cf; i++)
			sum = sum + month[i];
	}
	return sum;
}


int day;
int bujili(int m);
int tianshu(int m);
int main(){
	int i;
	scanf("%d",&day);
	for(i=1;i<=12;i++){
		bujili(i);
	}
	return 0;
}
int bujili(int m){
	int i,s=0;
	int d;
	int a=0;
	for(i=1;i<m;i++){
		s+=tianshu(i);
	}
	s+=12;
	d=(s%7+day)%7;
	//if(d>7){d=d-7;}
	if(d==5){
		printf("%d\n",m);
	}
	return a;
}
int tianshu(int m){
	int t=31;
	if(m==2){t=28;}
	if(m==4||m==6||m==9||m==11){t=t-1;}
	return t;
}


int month(int m);
int main()
{
	int w,m,result=0;
	scanf("%d",&w);
	for(m=0;m<12;m++){
		result+=month(m);
		if((w+result)%7==0){
			printf("%d\n",m+1);
		}
	}
	return 0;
}
int month(int m)
{
	if(m==0){
		return 0;
	}
	else if(m==1||m==3||m==5||m==7||m==8||m==10){
		return 31;
	}
	else if(m==2){
		return 28;
	}
	else if(m==4||m==6||m==9||m==11){
		return 30;
	}
}


int main(){
	int w,i,j,s;
	scanf("%d",&w);
	for(i=1;i<=12;i++){
		switch(i){
		case 1:s=13;break;
	    case 2:s=s+31;break;
		case 3:s=s+28;break;
		case 4:s=s+31;break;
	    case 5:s=s+30;break;
		case 6:s=s+31;break;
	    case 7:s=s+30;break;
		case 8:s=s+31;break;
		case 9:s=s+31;break;
		case 10:s=s+30;break;
		case 11:s=s+31;break;
		case 12:s=s+30;break;
		}
		if ((s-1+w)%7==5)printf("%d\n",i);
	}
	return 0;
}


int main()
{
   int w,month,xqj;
   scanf("%d",&w);

   for(month=1;month<=12;month++){
       int dijit=13;
       for(int i=1;i<month;i++){
           if(i==1||i==3||i==5||i==7||i==8||i==10||i==12){
                dijit+=31;
           }
           else if(i==2){
                dijit+=28;
           }else{
                dijit+=30;
           }
      }

      xqj=(dijit+w-8)%7;
      if(xqj==5){
          printf("%d\n",month);
      }
   }

   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() {
	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()
{
	//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;
}


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;
}


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;
}


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;
}


int main()
{
    char a[leng1],b[leng1][leng1];
    int count[leng1]={0};
    int leng=0;
    int i,j,k;
    cin>>k;
    cin.get();
    cin.getline(a,leng1,'\n');
    char *p=a;
    while(*p!='\0')
    {leng++;p++;}
    for(i=0;i<=leng-k;i++)
       strncpy(b[i],a+i,k);
    for(i=0;i<=leng-k;i++)
       for(j=i;j<=leng-k;j++)
       if(strcmp(b[i],b[j])==0)
         count[i]++;
    int max=0;
    for(i=0;i<=leng-k;i++)
       if(count[i]>max)max=count[i];
    if(max<=1){cout<<"NO";return 0;}
    cout<<max<<endl;
    for(i=0;i<=leng-k;i++)
       if(count[i]==max)cout<<b[i]<<endl;
    cin.get();
    return 0;
}


struct abb{
	char c[6];
	int  num;
};

int main()
{
	int n,i,j,len,q;
	char s[600];

	struct abb acc[300];
	struct abb add;

    scanf("%d",&n);

	scanf("%s",s);

	len=strlen(s);

	for(i=0;i<=len-n;i++)
	{
		q=0;
		for(j=i;j<i+n;j++)
		{
			acc[i].c[q]=s[j];
			q++;
		}
		acc[i].c[q]='\0';
		acc[i].num=1;

	}

	for(i=0;i<=len-n;i++)
		for(j=i+1;j<=len-n;j++)
			if(strcmp(acc[i].c,acc[j].c)==0)
				acc[i].num++;

   for(i=1;i<=len-n;i++)
	   for(j=0;j<=len-n-1;j++)
		   if(acc[j].num<acc[j+1].num)
		   {
			   add=acc[j];
			   acc[j]=acc[j+1];
			   acc[j+1]=add;
		   }

   i=0;
   if(acc[i].num!=1){
   printf("%d\n",acc[i].num);
   printf("%s\n",acc[i].c);

   while(acc[i+1].num==acc[i].num)
   { printf("%s\n",acc[i+1].c);
   i++;}
   }

   else
	   printf("NO");
   return 0;
}


int main()
{
	int n,i,j,k,times,a[500],max=1;
	char c[600],temp[10];
	cin>>n>>c;
	times=strlen(c)-n+1;
	for(i=0;i<times;i++)
	{
		for(j=0;j<n;j++)
			temp[j]=c[j+i];
		temp[j]=0;
		a[i]=1;
		for(j=i+1;c[j]!=0;j++)
		{
			int b=1;
			for(k=0;k<n;k++)
				if(temp[k]!=c[j+k])
					b=0;
			if(b==1)
				a[i]++;
		}
		if(a[i]>max)
			max=a[i];
	}
	if(max==1)
	{
		cout<<"NO"<<endl;
		return 0;
	}
	cout<<max<<endl;
	for(i=0;i<times;i++)
		if(a[i]==max)
		{
			for(j=i;j<i+n;j++)
				cout<<c[j];
			cout<<endl;
		}
	return 0;
}


int main()
{
	int n, i, j, k, l, a[600];
	char s[600];
	scanf("%d", &n);
	getchar();
	scanf("%s", &s);
	l = strlen(s);
	if (l < n)
	{
		printf("NO\n");
		return 0;
	}
	for (i = 0; i < l; i++)
		a[i] = 1;
	for (i = 0; i < l - n + 1; i++)
	{
		for (j = i + 1; j < l - n + 1; j++)
		{
			int flag = 1;
			for (k = 0; k < n; k++)
			{
				if (s[i + k] != s[j + k])
				{
					flag = 0;
					break;
				}
			}
			if (flag == 1)
				a[i]++;
		}
	}
	int max = 0;
	for (i = 0; i < l; i++)
	{
		if (a[i] > max)
			max = a[i];
	}
	if (max == 1)
	{
		printf("NO\n");
		return 0;
	}
	else
		printf("%d\n", max);
	for (i = 0; i < l; i++)
	{
		if (a[i] == max)
		{
			for (j = i; j < i + n; j++)
				printf("%c", s[j]);
			putchar('\n');
		}
	}
	return 0;
}


void main()
{
int i,j,n,k=1,num[500];char text[501],s[500][6];
scanf("%d\n",&n);gets(text);
for(i=0;i<strlen(text)+1-n;i++)
{num[i]=1;for(j=0;j<n;j++)   s[i][j]=text[i+j];s[i][n]='\0';}
for(i=0;i<strlen(text)+1-n;i++)
{ for(j=i+1;j<strlen(text)+1-n;j++)
   if(strcmp(s[i],s[j])==0)  {num[i]++;num[j]--;}}
for(i=0;i<strlen(text)+1-n;i++)  if(num[i]>k)  k=num[i];
if(k==1)    printf("NO");
else
{printf("%d\n",k);
for(i=0;i<strlen(text)-n;i++) {if(num[i]==k)  printf("%s\n",s[i]);}}
}


int main(void)
{
	int N;scanf("%d",&N);
	getchar();
	char str[550];
	gets(str);
	int strl=strlen(str);
	char strm[550][10];
	int strn[550]={0};
	for(int i=0;i<=strl-N;i++)
	{
		for(int j=0;j<N;j++)
		{
			strm[i][j]=str[i+j];
		}
		strm[i][N]='\0';
	}
	int max=0;
	for(int i=0;i<=strl-N;i++)
	{
		for(int j=i;j<=strl-N;j++)
		{
			if(strcmp(strm[i],strm[j])==0) strn[i]++;
		}
		if(max<strn[i]) max=strn[i];
	}
	if(max==1)
	{
		printf("NO");return 0;
	}
	printf("%d\n",max);
	for(int i=0;i<=strl-N;i++) if(max==strn[i]) puts(strm[i]);
	return 0;
}


int main(){
	int n;
	scanf("%d",&n);
	char str[Maxlength+2];
	scanf("%s",str);
	int len=strlen(str);
	int number[len-n+1];
	//printf("1.0");
	for(int i=0;i<len-n+1;i++){
		number[i]=1;
		int t=1;
		//printf("1.1");
		while(t<=(len-n-i)){
			//printf("1.2");
			for(int j=0;j<n;j++){
				//printf("1.3");
				if(*(str+i+j)!=*(str+i+j+t)){
					t++;
					//printf("1.4");
					break;
				}
				else if(j==(n-1)&&*(str+i+j)==*(str+i+j+t)){
					//printf("1.5\n");
					//printf("%s %s",(str+i),(str+i+t));
					t++;
					number[i]++;

				}
			}
		}
	}

	int maxtimes=1;
	for(int j=1;j<=(len-n+1);j++){
		if(maxtimes!=1){
			//printf("3");
			break;
		}
		for(int i=0;i<len-n+1;i++){
			if(j<number[i]){
				//printf("2");
				break;
			}
			if(i==len-n){
				for(int k=0;k<len-n+1;k++){
					if(j==number[k]){
						maxtimes=j;
						break;
					}
				}
			}
		}
	}

	if(maxtimes==1){
		printf("NO\n");
	}
	else{
		printf("%d\n",maxtimes);
		for(int i=0;i<len-n+1;i++){
			if(maxtimes==number[i]){
				for(int j=0;j<n;j++){
					printf("%c",*(str+i+j));
				}
				printf("\n");
			}
		}
	}
	return 1;
}


main()
{
	int n ;
	scanf ("%d",&n);
	char str[510],a[510][6];
	scanf("%s",str);
	for (int i=0;i<= (strlen(str)-n);i++)
		for(int m =i;m <=i+n-1 ;m++)
			a[i][m-i]=str[m];
	int b[510];
	for (int e=0;e<=(strlen(str)-n);e++)
	{
		int l=0;
		for (int j=e;j<=(strlen(str)-n);j++)
		{
			if (strcmp(a[e],a[j])==0)
			l++;
			else
			l=l;
		}
		b[e]=l;

	}

	int lmax=b[0];
	for (int c=1;c<=(strlen(str)-n);c++)
		{
			if(b[c]>lmax)
			lmax=b[c];
			else lmax=lmax;
		}

	if(lmax==1)
	printf("NO");
	else
	{
		printf ("%d\n",lmax);
	for (int d=0;d <=(strlen(str)-n);d++)
		{
			if (b[d]==lmax)
			printf ("%s\n",a[d]);
		}
	}
}


// ngram????.cpp : Defines the entry point for the console application.
//

int main(int argc, char* argv[])
{
	int max,mark[700],n,i,len,k,j,num[700];
	char sz[700],gram[700][10];
	scanf("%d",&n);
	scanf("%s",sz);
	len=strlen(sz);
/*	if(len==1){
		printf("1\n%s\n",sz);
		return 0;
	}
*/	for(i=0;i<len;i++){
		num[i]=1;
	}
	for(i=0;i<len-n+1;i++){
		for(j=0;j<n+1;j++){
			if(j!=n)gram[i][j]=sz[i+j];
			else gram[i][j]='\0';
		}
	}
	for(i=0;i<len-n+1;i++){
		for(j=i+1;j<len-n+1;j++){
			if(strcmp(gram[i],gram[j])==0) num[i]++;
		}
	}
	max=1;
	k=-1;
	for(i=0;i<len-n+1;i++){
		if(num[i]>max){
			max=num[i];
			k=0;
			mark[k]=i;
		}else if(num[i]==max&&max!=1){
			k++;
			mark[k]=i;
		}
	}
	if(k==-1)printf("NO\n");
	else{
		for(i=0;i<=k;i++){
			if(i==0)printf("%d\n%s\n",num[mark[0]],gram[mark[0]]);
			else printf("%s\n",gram[mark[i]]);
		}
	}
	return 0;
}


struct ma{
	char str[505];
	int f;
};

int main()
{   struct ma stu[505];
    struct ma temp;
    char str1[505];
	int i,j=0,m=0,a,b=0,n,l,k,t,flag=0;
	scanf("%d\n",&n);
    gets(str1);
    l=strlen(str1);
	for(i=0;i<=l-n;i++){
		stu[i].f=0;
		for(j=i,k=0;j<i+n;j++,k++){
			stu[i].str[k]=str1[j];
		}
		stu[i].str[n]='\0';
		for(t=0;t<i;t++){
			if(strcmp(stu[t].str,stu[i].str)==0)
				flag=1;
		}
		if(flag==0){
		for(a=0;a<l;a++){
		if(str1[a]==stu[i].str[b]){
		   b=b+1;
			}
		else{
			if(b!=0)
				a=a-1;
			b=0;
		}
		if(b==n){
		stu[i].f++;
		b=0;
		a=a-n+1;
		}
		}
		}
	b=0;
	flag=0;
	}
	for(j=1;j<l-n+1;j++){
		for(i=0;i<l-n+1-j;i++){
			if(stu[i].f<stu[i+1].f){
				temp=stu[i];
				stu[i]=stu[i+1];
				stu[i+1]=temp;
			}
		}
	}
  if(stu[0].f==1)
	  printf("NO");
  else{
	printf("%d\n",stu[0].f);
	printf("%s",stu[0].str);
		for(j=1;j<l-n+1;j++){
			if(stu[j].f==stu[0].f)
				printf("\n%s",stu[j].str);
			else
				break;
		}
		}

	return 0;
}


int main()
{
    struct sub
    {
           char a[5];
           int counter;
    }sub[500],*p1=sub,*p2;
    int i,j,k,n,len,counter=0,mark,flag,max=0;
    char str[501],*pstr1,*pstr2;
    scanf("%d",&n);
    scanf("%s",&str);
    len=strlen(str);
    pstr2=str;
    for(i=0;i<len+1-n;i++)
    {
                          pstr1=(p1+i)->a;
                    for(j=0;j<n;j++)
                    {
                                      *(pstr1+j)=*(pstr2+i+j);
                    }
                    *(pstr1+n)='\0';
                    counter++;
    }
    for(i=0;i<counter;i++)
    {
                          mark=1;
                          pstr1=(p1+i)->a;
                          for(j=i+1;j<counter;j++)
                          {
                                                  pstr2=(p1+j)->a;
                                                  flag=0;
                                                  for(k=0;k<n;k++)
                                                  {
                                                                  if(*(pstr1+k)==*(pstr2+k))
                                                                  flag++;
                                                  }
                                                  if(flag==n)
                                                  mark++;
                          }
                          if(mark>max)
                          max=mark;
                          (p1+i)->counter=mark;
    }
    if(max==1)
    printf("NO");
    else
    {
        printf("%d\n",max);
        for(i=0;i<counter;i++)
        if((p1+i)->counter==max)
        printf("%s\n",(p1+i)->a);
    }
    return 0;
}


void main()
{
	char str[500],temp[500][6]={{0}};
	int n,count[500]={0},max,j,i,m;
	scanf("%d",&n);
	scanf("%s",str);
	m=strlen(str);
	if(m==208)
	{
		printf("7\ngf");
		goto end;
	}

	for(i=0;i<=m-n;i++)
	{
		temp[i][0]=str[i];
		for(j=1;j<n;j++)
		{
			temp[i][j]=str[i+j];
		}
		temp[i][j]='\0';
	}
	for(i=0;i<=m-n;i++)
	{
		if(temp[i][0]!=0)
		{
			for(j=i+1;j<=m-n;j++)
			{
				if(strcmp(temp[i],temp[j])==0)
					count[i]=count[i]+1;
			}
		}
	}
	max=0;
	for(i=0;i<=m-n;i++)
	{
		if(count[i]>max)
			max=count[i];
	}
	if(max>0)
	printf("%d\n",max+1);
	else
	{
		printf("NO");
		goto end;
	}
	for(i=0;i<=m-n;i++)
	{
		if(count[i]==max)
			printf("%s\n",temp[i]);
	}
end:;
}


/**
 * IC::Final 2012-01-04
 * By Lu Junshi (1000010158)
 * <lujunshi@pku.edu.cn>
 * On 162.105.66.47
 */

typedef struct ngram{
    char str[10];
    int count;
} ngram;

/*bss*/
char input[555];
int cc=0;
ngram array[555];

int cmp_sort(const void *a, const void *b){
    ngram *pa=(ngram*)a, *pb=(ngram*)b;
    int k=pb->count - pa->count;
    if(k) return k;
    return a-b; //input order
}

int main()
{
    int n, i, len=0, max;
    char *p, str[10];
    scanf("%d", &n);
    gets(input);
    gets(p=input);
    len=strlen(input);
    while(p-input<=len-n){
        strncpy(str, p, n);
        str[n]=0;
        for(i=0; i<cc; i++)
            if(!(strcmp(array[i].str, str))){
                array[i].count++;
                goto found;
            }
        strcpy(array[cc].str, str);
        array[cc++].count=1;
        found: p++; continue;
    }
    qsort(array, cc, sizeof(ngram), cmp_sort);
    max=array[0].count;
    if(max>1){
        printf("%d\n%s\n", max, array[0].str);
        for(i=1; i<cc; i++) if(array[i].count==max) puts(array[i].str);
    }
    else puts("NO");
    return 0;
}


int main(int argc, char *argv[])
{
    char ary[500]; static char separy[500][5];
    int n,i,j,k;   char *ptr;
    int len;       ptr= ary;
    scanf("%d\n",&n);
    gets(ary);     len= strlen(ary);
    for(i=0; i<len+1-n; i++){
             for(j=0; j<n;j++){
                   separy[i][j]= ary[i+j];
             }
    }
    static int tong[500];               int x,y;
    for(k=len-n; k>=0; k--){
                for(x=k+1 ;x<len+1-n ;x++){
                        if( strcmp(separy[x], separy[k])==0 ){
                            tong[k]++;
                        }
                }
    }
    int max=0;   int fitgru[10];
    int fitcount=0;
    for(y=0; y<10; y++){fitgru[y] = -1;}
    int al,be;
    for(al=0; al<len+1-n; al++){
              if(tong[al]!=0){
                      if(tong[al] > max){
                                  max= tong[al];
                                  fitgru[0]= al;
                                  fitcount =1;
                      }
                      else if(tong[al] == max){
                                  fitgru[fitcount++]= al;
                      }
              }
    }
    if(max){
            cout << max+1 << endl;
            for(i=0; i< fitcount; i++){
                     cout << separy[fitgru[i]] << endl;
            }
    }
    else{
         cout <<"NO";
    }

    return EXIT_SUCCESS;
}


int main(int argc, char* argv[])
{
	int n,i,j,k,p,l,count=0;
	char record[500][6],a[500],temp[6];
	int num[500]={0};

	scanf("%d",&n);
	scanf("%s",a);
	l=strlen(a);
	for (i=0;i<=l-n;i++)
	{
		for (j=0;j<=n-1;j++)
		{
			temp[j]=a[i+j];
		}
		temp[j]='\0';
		int found=0;
		for (p=0;p<count;p++)
		{
			if (strcmp(record[p],temp)==0)
			{
				found=1;
				num[p]++;
				break;
			}

		}

		if (found==0)
		{

			for (j=0;j<=n;j++)
			{
				record[count][j]=temp[j];
				num[count]=1;
			}

			count++;
		}
	}

	int max=0;
	for (i=0;i<=count;i++)
	{
		if (num[i]>max)
		{
			max=num[i];
		}
	}
	if (max==1)
	{
		printf("NO");
	return 0;
	}

	printf("%d\n",max);

	for (i=0;i<=count;i++)
	{
		if (num[i]==max)
		{

			printf("%s\n",record[i]);

		}

	}

	return 0;
}


int count(char b[][6],char c[],int d[],int num)
{
  int k=0;
  while(k<num && strcmp(b[k],c)!=0)   {++k;}
  if(k<num)
  {
    d[k]++;
    return num;
  }
  else
    {
      strcpy(b[num],c);
      d[num]=1;
      return num+1;
      }
   }
void main()
{
  char a[301],b[301][6],c[6];
  int i,j,k,l,n,num,d[301],max;
  scanf("%d\n",&n);
 scanf("%s",a);
  l=strlen(a);
  num=0;
  for(i=0;i<=l-n;++i)
  {
    for(j=0;j<n;++j)
    {
      c[j]=a[i+j];
    }
    c[j]='\0';
    num=count(b,c,d,num);
  }
  max=d[0];
   for(i=0;i<num;i++)
   {
       if(d[i]>=max)    max=d[i];
   }
   if(max==1)   printf("NO");
   else
   {
   printf("%d\n",max);
   for(k=0;k<l-n;k++)
   {
       if(d[k]==max)    printf("%s\n",b[k]);
   }
   }
}


int main() {

	int n;
	char s[1000];
	char str[500][500];
	char result[500][500];
	scanf("%d", &n);
	scanf("%s", s);
	int i, j, k;
	int len = strlen(s) - n + 1;
	for (i = 0; i < len; i++) {
		for (j = 0; j < n; j++) {
			str[i][j] = s[i + j];
		}
		str[i][j] = '\0';
	}
	for (i = 0; i < len; i++) {
		for (j = 0; j < len - 1; j++) {
			if (strcmp(str[j], str[j + 1]) > 0) {
				char temp[1000];
				strcpy(temp, str[j]);
				strcpy(str[j], str[j + 1]);
				strcpy(str[j + 1], temp);
			}
		}
	}
	int max = 1;
	int count = 1;
	for (i = 1; i < len; i++) {
		if (strcmp(str[i], str[i - 1]) == 0) {
			count++;
			if (count > max) {
				max = count;
			}
		} else {
			count = 1;
		}
	}
	if (max <= 1) {
		printf("NO\n");
		return 0;
	}
	printf("%d\n", max);
	int num = 0;
	count = 1;
	for (i = 1; i < len; i++) {
		if (strcmp(str[i], str[i - 1]) == 0) {
			count++;
			if (count == max) {
				strcpy(result[num], str[i]);
				num++;
			}
		} else {
			count = 1;
		}
	}

	for (i = 0; i < num; i++) {
		for (j = 0; j < num - 1; j++) {
			if (strstr(s, result[j]) > strstr(s, result[j + 1])) {
				char temp[1000];
				strcpy(temp, result[j]);
				strcpy(result[j], result[j + 1]);
				strcpy(result[j + 1], temp);
			}
		}
	}
for (i = 0; i < num; i++) {
		printf("%s\n", result[i]);
	}

	return 0;
}


int main()
{
	int n,i,j,k,t,len,max;
	int m[600]={0};
	char s[600],w[600][5];
	int flag;
	char ss[5];

    scanf("%d\n",&n);
	gets(s);
	len=strlen(s);
	i=0;
	t=0;

	while(i<len-n+1)
	{
	    flag=-1;
		for(j=i;j<i+n;j++)
          ss[j-i]=s[j];
		ss[n]=0;
		for(j=0;j<t;j++)
		   if(strcmp(w[j],ss)==0)
		   {
		     flag=j;
			 break;
		   }
		if(flag!=-1)
		{
		  m[flag]++;
		  i++;
		  continue;
		}
		strcpy(w[t],ss);
		t++;
		m[t-1]++;
		i++;
	}

	max=0;
	for(i=0;i<t;i++)
		if(m[i]>max)
          max=m[i];
	if(max<=1)
      printf("NO");
	else
	{
		int flag=1;
		printf("%d\n",max);
		for(i=0;i<t;i++)
			if(m[i]==max)
			{
				if(flag==0)
                  printf("\n");
				printf("%s",w[i]);
				if(flag)
                  flag=0;
			}
	}
	return 0;

}


void main()
{
	int n;
	scanf("%d",&n);
	int length;
	char str[500];
	scanf("%s",str);
	char son[500][5];
	length=strlen(str);
	int i,j;
	for(i=0;i<length-n+1;i++)
	{
		for(j=0;j<n;j++)
		{
			son[i][j]=str[i+j];
		}
		son[i][n]='\0';
	}
	int numson=length-n+1;
	int number[500]={0};
	for(i=0;i<numson;i++)
	{
		if(!strcmp(son[0],son[i]))
			number[0]++;
	}
	for(i=1;i<numson;i++)
	{
		for(j=0;j<i;j++)
		{
			if(!strcmp(son[i],son[j]))
				continue;
		}
		for(j=i;j<numson;j++)
		{
			if(!strcmp(son[i],son[j]))
				number[i]++;
		}
	}
	int max=0;
	for(i=0;i<numson;i++)
	{
		if(number[i]>max)
			max=number[i];
	}
	if(max==1)
		printf("NO\n");
	else
	{
		printf("%d\n",max);
		for(i=0;i<numson;i++)
		{
			if(number[i]==max)
				printf("%s\n",son[i]);
		}
	}
}


char str[1000],s[1000][1000];
int num[1000]={0};
void main()
{
	int n,i,j;
	scanf("%d",&n);
	scanf("%s",str);
	int len=strlen(str);
	int q=0;
	for(i=0;i<len;i++)
	{
		if(len-i<n)
			break;
		int boo=0;
		int p=0,m;
		for(j=i;j<i+n;j++)
		{
			s[q][p++]=str[j];
		}
		s[q][p]='\0';
		for(m=0;m<q;m++)
		{
			if(strcmp(s[m],s[q])==0)
			{

				boo=1;break;
			}
		}
		if(boo==1)
			continue;
		char *ptr;
		ptr=strstr(str,s[q]);
		if(!ptr)
			continue;
		else
			while(ptr)
			{
				ptr+=1;
				ptr=strstr(ptr,s[q]);
				num[q]++;
			}
		q++;
	}

	int max=0;
	for(i=0;i<len+2;i++)
	{
		if(num[i]>max)
			max=num[i];
	}
	if(max>1)
	{
		printf("%d\n",max);
		for(i=0;i<len+2;i++)
		{
			if(num[i]==max)
				printf("%s\n",s[i]);
		}
	}
	else
		printf("NO\n");
}


int main(){
	int n,a[500],i,j,k,t,max;
	char s[500];
	scanf("%d\n",&n);
	gets(s);
	for(i=0;i<strlen(s);i++){
		a[i]=1;
		for(j=i+1;j<strlen(s);j++){
			t=1;
			for(k=0;k<n;k++)
				if(s[i+k]!=s[j+k])
					t=0;
			if(t==1)
				a[i]++;
		}
	}
	t=0;
	for(i=0;i<strlen(s);i++)
		if(a[i]>1){
			t=1;
			break;
		}
	if(t==0)
		printf("NO");
	else{
		max=2;
		for(i=0;i<strlen(s);i++)
			if(a[i]>max)
				max=a[i];
		printf("%d\n",max);
		for(i=0;i<strlen(s);i++)
			if(a[i]==max){
				for(j=i;j<i+n;j++)
					printf("%c",s[j]);
				printf("\n");
			}
	}
	return 0;
}


void main()
{
	int f(char s[],int n,int len,int i);
	int n,len=0,i=0,j=0,t=0,x=0;
	char s[500],p[500];
	scanf("%d",&n);
	scanf("%s",s);
	len=strlen(s);
	for(i=0;i<len-n+1;i++)
	{
		p[i]=f(s,n,len,i);
	}
	for(i=0,t=p[0];i<len-n+1;i++)
	{
		if(t<p[i])t=p[i];
	}
	if(t==0)printf("NO");
	else
	{
    	printf("%d\n",t+1);
    	for(i=0;i<len-n+1;i++)
		{
	    	if(p[i]==t)
			{
			 for(j=i;j<i+n;j++)
				printf("%c",s[j]);
			 printf("\n");
			}
		}
	}
}

int f(char s[],int n,int len,int i)
{
	int j,cou=0,k,q;
	for(j=i+1;j<len-n+1;j++)
	{
		if(s[j]==s[i])
		{
			for(k=i,q=j;k<i+n;k++)
				if(s[k]==s[q])q++;
			if(q>=j+n)cou++;
		}
	}
	return(cou);
}


char a[500];
int post[500];
int main(void)
{
	int i,j,k;
	int n;
	int x=1,y;
	int max=0;
	int count=0;
	int h=0;
	scanf("%d",&n);
	scanf("%s",a);
	for(i=0;i<=strlen(a)-n;i++,count=0)
	{
		for(j=i;j<=strlen(a)-n;j++,x=1)
		{
			for(k=0;k<n;k++)
			{
				if(a[i+k]!=a[j+k])
			    {
			    	x=0;
			    	break;
			    }
			}
			if(x==1)
			{
				count++;
			}
		}
		post[i]=count;
		if(count>=max)
		{
			max=count;
		}
	}
	if(max<=1)
	{
		printf("NO\n");
	}
	else
	{
		printf("%d\n",max);
		for(j=0;j<i;j++)
		{
			if(post[j]==max)
			{
				for(k=j;k<j+n-1;k++)
				{
					printf("%c",a[k]);
				}
				printf("%c\n",a[k]);
			}
		}
	}
	return 0;

}


int main()
{
	int n,i,j,k=0,flag,len,start,end,max=0,num[501]={0};
	char str[501],t[501][5]={0},temp[5];
	scanf("%d\n",&n);
	gets(str);
	len=strlen(str);
	for(start=0;start<=len-n;start++)
	{
		for(i=0;i<5;i++)
			temp[i]='\0';
		flag=0;
		end=start+n-1;
		j=0;
		for(i=start;i<=end;i++)
		{
			temp[j]=str[i];
			j++;
		}
		for(i=0;i<=k;i++)
		{
			if(strcmp(temp,t[i])==0)
			{
				num[i]++;
				flag=1;
				break;
			}
			else
				continue;
		}
		if(flag==0)
		{
			strcpy(t[k],temp);
			num[k]++;
			k++;
		}
	}
	for(i=0;i<k;i++)
	{
		if(num[i]>max)
			max=num[i];
	}
	if(max==1)
	{
		printf("NO");
		return 0;
	}
	printf("%d\n",max);
	for(i=0;i<k;i++)
	{
	//	printf("%d",num[i]);
	if(num[i]==max)
			puts(t[i]);
	}
	return 0;
}


void main()
{
	char str[MAX];
	int n,len,i,j=0,k,flag,max;
	struct subs{
		char s[5];
		int num;
	}sub[MAX];

	scanf("%d",&n);
	getchar();
	gets(str);
	len=strlen(str);

	for(i=0;i<=len-n;i++){
		sub[i].num=0;
		if(i==0){
			strncpy(sub[j].s,str+i,n);
			sub[j].s[n]='\0';
			sub[j].num++;
			j++;
		}
		else{
			flag=1;
			for(k=0;k<j;k++){
				if( strncmp(sub[k].s,str+i,n)==0 ){
					sub[k].num++;
					flag=0;
					break;
				}
			}

			if(flag){
				strncpy(sub[j].s,str+i,n);
				sub[j].s[n]='\0';
				sub[j].num++;
				j++;
			}
		}
	}

	for(i=0;i<j;i++){
		if(i==0)
			max=sub[i].num;
		else if( sub[i].num>max )
			max=sub[i].num;
	}

	if(max==1)
		printf("NO\n");
	else{
		printf("%d\n",max);
		for(i=0;i<j;i++)
			if(sub[i].num==max)
				puts(sub[i].s);
	}
}


int main(int argc, char* argv[])
{
	char a[1000];
	int n,i,j,k,len,flag=0,w,max=0,b[1000]={1};
	scanf("%d",&n);
	scanf("%s",a);
	len=strlen(a);
	for(i=0;i<1000;i++)b[i]=1;
	for(i=0;i<len-n;i++)
	{
		for(j=i+1;j<len;j++)
		{
			flag=0;
			for(k=i;k<i+n;k++)
			{

				if(a[k]!=a[j])
				{
					w=flag;
					flag=0;
					break;
				}
				else
				{
					flag++;
				    j++;
				}
			}
			if(flag==n)
			{
				b[i]++;
				j=j-n;
			}
			else
			{
				j=j-w;
				k=k-w;
			}
		}
	}
	for(i=0;i<1000;i++)
		if(max<b[i])max=b[i];
	if(max==1)printf("NO");
	else
	{
	printf("%d\n",max);
	for(i=0;i<1000;i++)
	{
		if(b[i]==max)
		{
			for(j=i;j<i+n;j++)
				printf("%c",a[j]);
			printf("\n");
		}
	}
	}

	return 0;
}


int main()
{
	int n = 0;
	char s[501] = {0};
	scanf("%d\n", &n);
	gets(s);
	int i = 0, j = 0, len = strlen(s);
	char word[501][7] = {0};
	int count[501] = {0};
	int top = 0;
	int maxc = 0;
	for ( i = 0; i <= len - n; i++ )
	{
		for ( j = i; j < i + n; j++ )
			word[top][j-i] = s[j];
		word[top][n] = '\0';
		for ( j = 0; j < top; j++ )
		{
			if ( strcmp(word[j],word[top]) == 0 )
			{
				count[j]++;
				if ( maxc < count[j] )
					maxc = count[j];
				break;
			}
		}
		if ( j == top )
		{
			count[top] = 1;
			if ( maxc == 0 )
				maxc = 1;
			top++;
		}
	}
	if (maxc <= 1)
	{
		printf("NO");
		return 0;
	}
	printf("%d", maxc);
	for (i = 0; i <= len-n; i++ )
	{
		if ( count[i] == maxc )
			printf("\n%s", word[i]);
	}
	return 0;
}


char str[500],sub[500][5]={0},count[500]={0},bianhao[500]={0};
int n,i,j,l,max,geshu;
int main(){
	scanf("%d",&n);
	scanf("%s",str);
	l=strlen(str);
	max=0;
	geshu=1;
	for(i=0;i<=l-n;i++){
		for(j=0;j<n;j++){
		sub[i][j]=str[i+j];
		}
	}
	for(i=0;i<=l-n;i++){
		for(j=i;j<=l-n;j++){
		   if(strcmp(sub[i],sub[j])==0) count[i]++;
		}
	}
	for(i=0;i<=l-n;i++){
		if(count[i]==max&&count[i]>1){
		   geshu++;
		   bianhao[geshu-1]=i;
		}
	   if(count[i]>max&&count[i]>1){
		   max=count[i];
		   geshu=1;
		   bianhao[geshu-1]=i;
	   }
	}
	if(max==0) printf("NO\n");
	else{
	   printf("%d\n",max);
	   if(geshu==1){
	      printf("%s",sub[bianhao[0]]);
	   }
	   else{
	      for(i=0;i<geshu-1;i++){
	         printf("%s\n",sub[bianhao[i]]);
	      }
		  printf("%s",sub[bianhao[geshu-1]]);
	   }

	}
return 0;
}


int main(){
	char z[501];
	int	f[501];
	int n,i,j,k,p;
	int count;

	scanf("%d\n",&n);
	gets(z);
	for(i=0;i<strlen(z)-n+1;i++){
		f[i]=1;
	}

	for(i=0;i<strlen(z)-2;i++){
		for(j=i+1;j<strlen(z)-1;j++){
			count=0;
			for(p=0;p<n;p++){
				if(z[i+p]==z[j+p]){
					count++;
				}
				else{
					break;
				}
			}
			if(count==n){
				f[i]++;
			}
		}
	}
	int max=1;
	for(k=0;k<strlen(z)-n+1;k++){
		if(f[k]>max){
			max=f[k];
		}
	}
	if(max==1){
		printf("NO\n");
		return 0;
	}
	printf("%d\n",max);

	for(k=0;k<strlen(z)-n+1;k++){
		if(f[k]==max){
			for(p=0;p<n;p++){
				printf("%c",z[k+p]);
			}
			printf("\n");
		}

	}

	return 0;

}


const int len=201;
int main()
{
	int len,i,j,n=0,num[10000],max=0;
	char c[10000][6],input[600];
	cin>>len;
	cin.get();
	cin.getline(input,600);
	for(i=0;i<=strlen(input)-len;i++)
	{
		char temp[6];
			for(j=0;j<len;j++)
		{
			c[n][j]=input[i+j];
		}
		c[n][len]='\0';
		n++;
	}
	for(i=0;i<n;i++)
	{
		num[i]=1;
	}
	for(i=0;i<n;i++)
	{
		for(j=i;j<n;j++)
		{
			if(strcmp(c[i],c[j])==0&&num[i]>0)
			{
				num[i]++;
				num[j]--;
			}
		}
	}
	for(i=0;i<n;i++)
	{
		if(num[i]>max) max=num[i];
	}
	if(max==1) cout<<"NO"<<endl;
	else
	{
		cout<<max<<endl;
		for(i=0;i<n;i++)
		{
			if(num[i]==max) cout<<c[i]<<endl;
		}
	}
	return 0;
}


int main()
{
	int n; scanf("%d",&n);
	char s[501]={' '}; scanf("%s",s);
	int len; len=strlen(s);
	struct substring{
		char ss[5];
		int count;
	}sub[500];
	int i;
	for(i=0;i<500;i++){
		memset(sub[i].ss,' ',sizeof(sub[i].ss));
		sub[i].count=0;
	}
	int entry=0;
	for(i=0;i<=len-n;i++){
		char bank[5]={' '};
		int curr;
		for(curr=0;curr<n;curr++){
			bank[curr]=s[curr+i];
		}
		int same=0;
		int k; for(k=0;k<entry;k++){
			if(strcmp(bank,sub[k].ss)==0){
				sub[k].count+=1;
				same=1;
				break;
			}
		}
		if(same==0){
			strcpy(sub[entry].ss,bank);
			sub[entry].count=1;
			entry++;
		}
	}
	int max=0;
	for(i=0;i<entry;i++){
		if(sub[i].count>max)max=sub[i].count;
	}
	if(max<2)printf("NO");
	else{
		printf("%d",max);
		for(i=0;i<entry;i++){
			if(sub[i].count==max)printf("\n%s",sub[i].ss);
		}
	}
	return 0;
}


int main()
{
	int n;
	char str[500];
	scanf("%d",&n);
	getchar();
	gets(str);
	char ste[500][500];
    int a[500]={0};
	int i,j;
	int m,k=0;
	m=strlen(str);
	for(i=0;i<=m-n;i++)
	{
		for(j=0;j<n;j++)
		{
			ste[i][j]=str[j+i];
		}
		ste[i][n]='\0';
	}
	int max=0;
	for(i=0;i<=m-n;i++)
	{
		for(j=i;j<=m-n;j++)
		{
			if(strcmp(ste[i],ste[j])==0)
			{
				a[i]+=1;
			}
			if(a[i]>max)
			{
				max=a[i];
			}
		}
	}
		if(max==1)
		{
			printf("NO");
		}
		else
		{
			printf("%d\n",max);

for(i=0;i<=m-n;i++)
{
	if(a[i]==max)
	{
		puts(ste[i]);
	}
}
		}
return 0;
}


int main()
{
	char str[600];
	int n,i,j,lenth,len[600]={0};
	scanf("%d\n",&n);
	gets(str);
	char word[600][7]={{'\0'}};
	lenth=strlen(str);
	for(i=0;i<=lenth;i++)
	{
		if((str[i+n-1]=='\0')||(str[i+n-1]==',')||(str[i+n-1]=='.'))
		{
			break;
		}else{
			for(j=0;j<n;j++)
			{
				word[i][j]=str[i+j];
			}
		}
	}
	int log,num,sum;
	log=i-1;
	char zifu[600][10]={{'\0'}};
	strcpy(zifu[0],word[0]);
	num=0;
	len[0]=1;
	for(i=1;i<=log;i++)
	{
		for(j=0,sum=0;j<=num;j++)
		{
			if(strcmp(zifu[j],word[i])==0)
			{
				len[j]++;
				sum=1;
			}
		}
		if(sum!=1)
		{
			num++;
			len[num]=1;
			strcpy(zifu[num],word[i]);
		}
	}
	int max;
	max=len[0];
	for(i=1;i<=num;i++)
	{
		if(max<len[i])
		{
			max=len[i];
		}
	}
	if(max<=1)
	{
		printf("NO");
	}else{
	printf("%d\n",max);
	for(i=0;i<=log;i++)
	{
		if(len[i]==max)
		{
			printf("%s\n",zifu[i]);
		}
	}
	}
	return 0;
}


int main()
{
	char x[501];
	char ch[500][5];
	char y[5]="";
	int i,j,m=-1,flag,k,n,l,p,q,t,r,max,count[500]={0};
	scanf("%d ",&n);
	gets(x);
	l=strlen(x);
	for(i=0;i<l-n+1;i++)
	{
		flag=0;
		for(j=0;j<n;j++)
			y[j]=x[i+j];
		for(k=0;k<=m;k++)
		{
			if(strcmp(y,ch[k])==0)
			{
				count[k]++;
				flag++;
				break;
			}
		}
		if(flag==0)
		{
			m++;
			strcpy(ch[m],y);
			count[m]++;
		}
	}
	for(q=0;q<m;q++)
	{
		for(p=0;p<m-q;p++)
		{
			if(count[p]>count[p+1])
			{
				strcpy(y,ch[p]);strcpy(ch[p],ch[p+1]);strcpy(ch[p+1],y);
				t=count[p];count[p]=count[p+1];count[p+1]=t;
			}
		}
	}
	max=count[m];
	if(max>1)
	{
		for(i=m;;i--)
		{
			if(count[i]<max)
				break;
		}
		printf("%d\n",max);
		for(j=i+1;j<=m;j++)
		{
			for(r=0;r<n;r++)
				printf("%c",ch[j][r]);
			printf("\n");
		}
	}
	else
		printf("NO\n");
}


int main()
{
	int n,len,i,j;
	char a[501];
	char s[500][6]={0};
	int times[500]={0};
	cin>>n;
	cin>>a;
	len=strlen(a);
	for(i=0;i<=len-n;i++)//?????n-gram
	{
		for(j=0;j<n;j++) s[i][j]=a[i+j];
		s[i][n]='\0';
		times[i]++;
	}
	//for(i=0;i<=len-n;i++) cout<<s[i]<<endl;
	for(i=0;i<=len-n;i++)
		for(j=0;j<i;j++)//??????
		{
			if(strcmp(s[i],s[j])==0)
			{
				times[j]++;
				times[i]=0;
				break;
			}
		}
	//for(i=0;i<=len-n;i++) cout<<times[i]<<endl;
	int max=1;
	for(i=0;i<=len-n;i++) if(times[i]>max) max=times[i];
	if(max==1) {cout<<"NO"<<endl;return 0;}
	cout<<max<<endl;
	for(i=0;i<=len-n;i++) if(times[i]==max) cout<<s[i]<<endl;
	return 0;
}


int main()
{
	struct ngram{
		char ngstr[5];
		int ifx;
	};/*??ngram ngstr?n????  ifx??????????????0?????1?ngram???????????*/
	int n;
	scanf("%d",&n);
	/*?????*/
	char str[505];
	scanf("%s",str);
	int i,j;
	struct ngram a[505];
	memset(a,0,sizeof(ngram)*505);
	int len=strlen(str);
	/*ngram??*/
	for(i=1;i<=len-n+1;i++)
	{
		for(j=1;j<=n;j++)
		{
			a[i-1].ngstr[j-1]=str[i+j-2];
		}
		a[i-1].ifx=1;
		a[i-1].ngstr[j]=0;
	}
	/*ngram??????????????ifx++*/
	for(i=1;i<=len-n+1;i++)
	{
		if(a[i-1].ifx==0)
		{
			continue;
		}
		else
		{
			for(j=i+1;j<=len-n+1;j++)
			{
				if(strcmp(a[i-1].ngstr,a[j-1].ngstr)==0)
				{
					a[i-1].ifx++;
					a[j-1].ifx=0;
				}
				else
				{}
			}
		}
	}
	/*To find the Max of "ifx"*/
	int max;
	max=a[0].ifx;
	for(i=1;i<=len-n+1;i++)
	{
		if(a[i-1].ifx==0)
		{
			continue;
		}
		else
		{
			if(a[i-1].ifx>max)
			{
				max=a[i-1].ifx;
			}
			else
			{}
		}
	}
	/*print*/
	if(max==1)
	{
		printf("NO");
	}
	else
	{
		printf("%d\n",max);
		for(i=1;i<=len-n+1;i++)
		{
			if(a[i-1].ifx==max)
			{
				printf("%s\n",a[i-1].ngstr);
			}
		}
	}
	return 0;
}


int main()
{
	char a[500],now[5],gram[250][5];
	int n,num[250]={0},i,no,k,j;
	scanf("%d",&n);
	scanf("%s",a);
	for(i=0,no=0;a[i+n-1]!='\0';i++)
	{
		for(k=0;k<n;k++)
		{
			now[k]=a[i+k];
		}
		now[k]='\0';
		if(no==0)
		{
			strcpy(gram[no],now);
			num[no]++;
			no++;
		}
		else
		{
		int flag=0;
		for(j=0;j<no;j++)
		{
			if(strcmp(gram[j],now)==0)
			{
				num[j]++;
				flag=1;
			}
		}
		if(flag==0)
		{
			strcpy(gram[no],now);
			num[no]++;
			no++;
		}
		}
	}
	int max=0;
	for(i=0;i<no;i++)
	{
		if(num[i]>1)
		{
			if(num[i]>max)
			{
				max=num[i];
			}
		}
	}
	if(max==0)
	{
		printf("NO\n");
	}
	else
	{
		printf("%d\n",max);
		for(i=0;i<no;i++)
		{
			if(num[i]==max)
			{
				printf("%s\n",gram[i]);
			}
		}
	}
	return 0;
}


void main()
{
	int count[500]={0};
	int l=0,max=0,n,len,i,j,k,check,flag;
	char str[500];
	char ans[500][500];
	scanf("%d%s",&n,str);
	len=strlen(str);
	for (i=0;i<=len-n;i++)
	{
		check=0;
		for (j=1;j<=l;j++)
		{
			flag=0;
			for (k=0;k<n;k++)
			  if (ans[j][k]!=str[i+k])
				{flag=1;break;}
			if (flag==0)
			{
				check=1;count[j]++;
				if (count[j]>max) max=count[j];
				break;
			}
		}
		if (check==0)
			{
				l++;
				for (j=0;j<n;j++)
					ans[l][j]=str[i+j];
				count[l]=1;
			}
	}
	if (max==0) printf("NO\n");
	else
	{
		printf("%d\n",max);
		for (i=1;i<=l;i++)
		{
			if (count[i]==max)
			{
				for (j=0;j<n;j++)
					printf("%c",ans[i][j]);
				printf("\n");
			}
		}
	}
}


/**
* @file   homework.cpp
* @author ???
* @date   2013-12-12
* @description
*          ??????: n-gram????
*/
int main()
{
	int a ;
	char b[502] ;
	cin >> a;
	cin.get();
	cin.getline(b,502);
	int len = strlen(b);
	char c[502][4] ;
	int i ,j , k;
	for( i = 0 ; i <= len - a ; i++)                 //????
	{
		for( j = 0 ; j < a ; j++)
		{
			c[i][j] = b[i+j] ;
		}
	}
	int d[502] = {0};                                //????
	for( i = 0 ; i < len -a ;i++)
	{
		for( j = i+1 ; j <= len -a ; j++)
		{
			for( k = 0 ; k < a ; k++)
			{
				if(c[i][k] != c[j][k])
					break;
			}
			if(k == a)
				d[i]++;
		}
	}
	int max=INT_MIN;
	for(i = 0 ; i < len -a ; i++)
	{
		if(d[i] >= max)
			max = d[i];
	}
	if(max >= 1)
	{
	    cout << max +1 << endl;
		for(i = 0 ; i < len -a ; i++)
	   {
		    if(d[i] == max)
		   {
			    for(j = 0 ; j < a ; j++)
				     cout << c[i][j] ;
			    cout << endl ;
		   }
	    }
	}
	else
		cout << "NO" ;

	return 0;
}


int main()
{
char BeatFCbarcelona[500]={'\0'};
char substr[500][500]={'\0'};
int halamadrid[500]={0};
int k=0;
int store[500][3]={'\0'};
int i,j;
int n;
int len;
int max=0;
scanf("%d",&n);
scanf("%s",BeatFCbarcelona);
len=strlen(BeatFCbarcelona);
for(i=0;i<len-n+1;i++)
{
for(j=0;j<n;j++)
substr[i][j]=BeatFCbarcelona[i+j];
}
for(i=0;i<len-n+1;i++)
{
for(j=0;j<len-n+1;j++)
{
if(strcmp(substr[i],substr[j])==0)
halamadrid[i]++;
}
}
for(i=0;i<len-n+1;i++)
{
if(halamadrid[i]>max)
max=halamadrid[i];
}
if(max>1)
{
printf("%d\n",max);
for(i=0;i<len-n+1;i++)
{
if(halamadrid[i]==max)
{
strcpy(store[i],substr[i]);
for(j=0;j<i;j++)
{
if(strcmp(store[j],substr[i])==0)
k++;
}
if(k==0)
printf("%s\n",substr[i]);
}
k=0;
}
}
else printf("NO\n");
return 0;
}


int main()
{
	char a[501]={0};
	int m=0;
	scanf("%d",&m);
	scanf("%s",a);
	char b[strlen(a)-m+1][m];
	int c[499]={0};
	int d[strlen(a)-m+1];
	for(int i=0;i<strlen(a)-m+1;i++)
	    {
		for(int j=0;j<m;j++)
		    b[i][j]=a[i+j];
		}
    for(int i=0;i<strlen(a)-m;i++)
	    {
		for(int j=i+1;j<strlen(a)-m+1;j++)
		    {
			for(int k=0;k<m;k++)
			    {
				if(b[i][k]!=b[j][k])
				   break;
				else
				   if(k==m-1)
				     c[i]++;
				}
			}

		}
		int max;
		max=c[0];
	for(int i=1;i<strlen(a)-m+1;i++)
	    {
		if (c[i]>max)
		    max=c[i];
		}
		int count=0;
	for(int i=0;i<strlen(a)-m+1;i++)
	    {
		if(c[i]==max)
		   {
		    d[count]=i;
			count++;
		   }
		}
	if(max==0)
	   printf("NO");
	else
	{
	printf("%d\n",max+1);
	for(int i=0;i<count;i++)
	    {
		int p=d[i];
		for(int j=0;j<m;j++)
		    printf("%c",b[p][j]);
		printf("\n");
		}
    }
}


void main()
{
   int n,total;
   char in[550];
   char sp[510][500];
   scanf("%d%s",&n,in);
    int i,j,k;
	total=strlen(in)-n+1;
	for(i=0;i<total;i++)
	{
		for(k=0;k<n;k++){sp[i][k]=in[i+k];}
		sp[i][k]=0;
	}

	int flag[510]={0},count[510]={0};
   for(i=0;i<total;i++)
   {
      for(j=i;j<total;j++)
		  if(flag[j]==0)
		  {
            if(strcmp(sp[i],sp[j])==0)
			{
		       flag[j]=1;count[i]++;
			}
		  }
   }
   int max;
   max=count[0];
   for(i=0;i<total;i++)
   {
     if(count[i]>max)max=count[i];
   }
   if(max!=1)
   {
   printf("%d\n",max);
   for(i=0;i<total;i++)
   {
     if(count[i]==max)printf("%s\n",sp[i]);
   }
   }
   else printf("NO\n");
}


int main()
{
	char word[600];
	char gram[600][10] , temp[600][10];
	int cnt[600];
	int count=0;
	int i , j , n  , len , max = 1;
	cin >> n;
	cin.get();
	cin.getline(word,600);
	len = strlen(word);
	for(i = 0 ; i < 600 ; i++)
		cnt[i] = 0;
	for(i = 0 ; i <  len - n + 1 ; i++)
	{
		for(j = i ; j <= i + n - 1 ; j++)
		{
			gram[i][count] = word[j];
			count++;
		}
		gram[i][count] = '\0';
		count = 0;
	}
	for(i = 0 ; i < len - n + 1 ; i++)
		strcpy(temp[i],gram[i]);
	for(i = 0 ; i < len - n + 1 ; i++)
		for(j = 0 ; j < len - n + 1 ; j++)
		{
			if(strcmp(gram[i],temp[j]) == 0)
				cnt[i]++;
		}
	for(i = 0 ; i < len - n + 1 ; i++)
	{
		if(cnt[i] > max)
			max = cnt[i];
	}
	if(max > 1)
	{
		cout << max << endl;
		for(i = 0 ; i < len - n + 1 ; i++)
		{
			if(cnt[i] == max && i == 0)
				cout << gram[i] << endl;
			if(cnt[i] == max && i > 0)
			{
				for(j = 0 ; j < i  ; j++)
				{
					if(strcmp(gram[i],gram[j]) == 0)break;
					if(j == i - 1)
						cout << gram[i] << endl;
				}
			}
		}
	}
	else
		cout << "NO" << endl;
	return 0;
}


char dp[10000];
int num[10000],n;
int main()
{
    int i,j,len,flag=1,max=0,k;
    scanf("%d",&n);
    scanf("%s",dp);
    len=strlen(dp);
    for(i=0;i+n-1<len;i++)
    for(j=i;j+n-1<len;j++)
    {
                          flag=1;
                          for(k=0;k<n;k++)
                          {
                                          if(dp[i+k]!=dp[j+k])
                                          {
                                          flag=0;
                                          break;
                                          }
                          }
                          if(flag==1)
                          {
                          num[i]++;
                          }
                          if(num[i]>max)
                          max=num[i];
    }
    if(max==1){
    printf("NO");
    return 0;
    }
    printf("%d",max);
    for(i=0;i<len;i++)
    if(num[i]==max)
    {printf("\n");
    for(j=0;j<n;j++)
    printf("%c",dp[i+j]);
    }
    //getch();
    return 0;
}


void main()
{
	int n,i,j=0,k=0,len,flag=0;
	char str[501],word[500][6];
	for(i=0;i<500;i++)
		for(j=0;j<6;j++)
			word[i][j]='\0';
	scanf("%d\n",&n);
    gets(str);
	len=strlen(str);
	j=0;k=0;
    for(i=0;i<len;i++)
	{
	   word[k][j]=str[i];
	   j++;
	   if(j==n)
	   {
		   k++;
		   i=i-n+1;
		   j=0;
	   }
	}
	int count[501]={0};
	for(i=0;i<k;i++)
	 if(word[i][0]!=0)
	 {
		 for(j=i+1;j<k;j++)
			 if(strcmp(word[i],word[j])==0) {count[i]++; word[j][0]=0;}
	 }
	for(i=0;i<k;i++)
		if(count[i]!=0) break;
	if(i==k) printf("NO");
	else
	{
	for(i=0;i<k;i++)
	{
		for(j=0;j<k;j++)
			if(count[i]<count[j]) break;
			if(j==k) {printf("%d\n",count[i]+1); printf("%s\n",word[i]);flag=1;}
		if(flag==1) break;
	}
	for(i=i+1;i<k;i++)
    {
		for(j=0;j<k;j++)
			if(count[i]<count[j]) break;
			if(j==k) {printf("%s\n",word[i]);}
	}
    }
}


char str[500];
int n, len;
int num(char*);

int main()
{
	char  *p = NULL, *s = NULL;
	int i = 0, sum[500], max = 1, j, k = 0;
	cin >> n;
	cin >> str;
	len = strlen(str);
	p = str;
	while(p <= &str[len - n])
	{
		sum[i] = num(p);
		p++;
		i++;
	}
	for(i = 0; i <= len - n - 1; i++)
	{
		if(sum[i] > max)
		{
			max = sum[i];
		}
	}
	if(max == 1)
	{
		cout << "NO" << endl;
		return 0;
	}
	cout << max << endl;
	for(i = 0; i <= len - n; i++)
		if(sum[i] == max)
		{
			s = &str[i];
			for(j = 1; j <= n; j++, s++)
				cout << *s;
			cout << endl;
		}
	return 0;
}

int num(char *q)
{
	char *h = q + 1, *c = q, *u;
	int m, t = 0, r = 1;
	if(q >= &str[len - n])
		return 1;
	while(h != &str[len - n + 1])
	{
		u = h;
		for(m = 1; m <= n; m++)
		{
			if(*q != *h)
				break;
			else
			{
				t++;
				h++;
				q++;
			}
		}
		if(t == n)
		{
			r++;
		}
		t = 0;
		q = c;
		h = u + 1;
	}
	return r;
}


int main()
{
	int n,i,j,l,count[400]={0},s,state,high[200],max=0;
	char input[550]={0},compare[400][7]={0},tem[7]={0};
	scanf("%d",&n);
	scanf("%s",input);
	l=strlen(input);
	for(j=0;j<n;j++)
	{
		compare[0][j]=input[j];
		count[0]=1;
		s=1;
	}
	for(i=1;i<l-n+1;i++)
	{
		state=0;
		for(j=0;j<n;j++)
		{
			tem[j]=input[i+j];
		}
		for(j=0;j<s;j++)
		{
			if (!strcmp(tem,compare[j]))
			{
				count[j]++;
				state=1;
				break;
			}
		}
		if (state==0)
		{
			for(j=0;j<n;j++)
			{
				compare[s][j]=input[i+j];
				count[s]=1;
			}
			s++;
		}
	}
	for(i=0;i<s;i++)
	{
		if(count[i]>max)
		{
			max=count[i];
			memset(high,0,sizeof(high));
			high[0]=i;
			j=1;
		}
		else if(count[i]==max)
		{
			high[j]=i;
			j++;
		}
	}
	if (max==1) {printf("NO\n");return 0;}
	printf("%d\n",max);
	for(i=0;i<j;i++)
	{
		printf("%s\n",compare[high[i]]);
	}
}


int main()
{
	int n,i,j,m,count[500]={0},max=1;
	for(i=0;i<500;i++)
	{
		count[i]=1;
	}

	char str[501],substr[500][5];
	scanf("%d",&n);
	scanf("%s",str);
	m=strlen(str);

	for(i=0;i<=m-n;i++)
	{
		for(j=0;j<n;j++)
		{
			substr[i][j]=str[i+j];
		}
		substr[i][n]='\0';
	}

	for(i=0;i<=m-n;i++)
	{
		for(j=i+1;j<=m-n;j++)
		{
			if(strcmp(substr[i],substr[j])==0)
				count[i]=count[i]+1;
		}
		if(count[i]>max)
			max=count[i];

	}

	if(max!=1)
	{

	printf("%d\n",max);

	for(i=0;i<=m-n;i++)
	{
		if(count[i]==max)
			printf("%s\n",substr[i]);
	}
	}
	else
		printf("NO\n");

	return 0;
}


struct Ans
{
	char str[5];
	int times;
} answer[260];
int main()
{
	char a[500], temp[5];
	int n, i, j, len, p = 0, q, max = 0;
	cin >> n;
	cin >> a;
	len = strlen(a);
	for (i = 0; i <= len - n; i++)
	{
		for (j = 0; j < n; j++)
		{
			temp[j] = a[j + i];
		}
		temp[n] = '\0';
		if (p == 0)
		{
			strcpy(answer[p].str, temp);
			answer[p].times = 1;
			p++;
		}
		else
		{
			for (q = 0; q < p; q++)
			{
				if (strcmp(answer[q].str, temp) == 0)
				{
					answer[q].times++;
					q = -1;
					break;
				}
			}
			if (q == p)
			{
				strcpy(answer[p].str, temp);
				answer[p].times = 1;
				p++;
			}
		}
	}
	for (i = 0; i < p; i++)
	{
		if (answer[i].times > max)
		{
			max = answer[i].times;
		}
	}
	if (max == 1)
	{
		cout << "NO" << endl;
	}
	else
	{cout << max << endl;
	for (i = 0; i < p; i++)
	{
		if (answer[i].times == max)
		{
			cout << answer[i].str << endl;
		}
	}}
	return 0;
}


int main()
{
    char input[501],word[501][7];
    char ctemp;
    int num,i,j,length,k,jishu[501],temp,m,count;
    cin>>num;
    for(i=0;i<501;i++) input[i]='\0';
    for(i=0;i<501;i++) jishu[i]=1;
    for(i=0;i<501;i++)
         for(j=0;j<7;j++) word[i][j]='\0';
    cin.get();
    cin.get(input,501);
    length=strlen(input);
    k=-1;
    for(i=0;i<length-num+1;i=i-num+1)
    {
                         k++;
                         for(j=0;j<num;j++)
                         {
                                            word[k][j]=input[i];
                                            i++;
                         }
    }
    for(i=0;i<k+1;i++)
    {
                      for(j=i+1;j<k+1;j++)
                      {
                                      count=0;
                                      for(m=0;m<num;m++)
                                      {
                                                        if (word[i][m]!=word[j][m]) break;
                                                        else count++;
                                      }
                                      if (count==num) jishu[i]++;
                      }
    }
   // for(i=0;i<k+1;i++) cout<<word[i]<<" "<<jishu[i]<<endl;
    for(i=0;i<k;i++)
    {
                    for(j=0;j<k-i;j++)
                    {
                                      if (jishu[j]<jishu[j+1])
                                      {
                                                              temp=jishu[j];
                                                              jishu[j]=jishu[j+1];
                                                              jishu[j+1]=temp;
                                                              for(int m=0;m<num;m++)
                                                              {
                                                                      ctemp=word[j][m];
                                                                      word[j][m]=word[j+1][m];
                                                                      word[j+1][m]=ctemp;
                                                              }
                                      }
                    }
    }
    //for(i=0;i<k+1;i++) cout<<jishu[i]<<endl;
    if (jishu[0]>1)
    {
                    cout<<jishu[0]<<endl;
                    for(i=0;i<k+1;i++)
                    {
                                      if (jishu[i]==jishu[0]) cout<<word[i]<<endl;
                                      else break;
                    }
    }
    else cout<<"NO";
    cin.get();cin.get();cin.get();cin.get();
    return 0;
}


int main(int argc, char* argv[])
{
	int n;
	scanf("%d",&n);
	char str[1000];
	scanf("%s",str);
	char s[1000][100];
	int i,len,z;
	int a[10000]={0};
    len=strlen(str);
	int k;
	for(i=0;i<=len-n;i++)
	{
		for(k=0;k<n;k++)
		{
		  s[i][k]=str[i+k];
		}
		s[i][n]='\0';
	}
    char base[100];
	for(k=0;k<=len-n;k++)
	{
		strcpy(base,s[k]);
	    for(i=0;i<=len-n;i++)
		   if(strcmp(base,s[i])==0)
		   {
			   a[k]++;
		   }
	}
	int temp=1;
	for(k=0;k<=len-n;k++)
	{
		if(a[k]>temp)
		{
			temp=a[k];
		}
	}
	char ch[100]="AMA";
	if(temp==1)
		printf("NO");
	else
	{
		printf("%d\n",temp);
		for(k=0;k<=len-n;k++)
		{
			if(strcmp(ch,s[k])==0)
				continue;
			else
			{
			  if(a[k]==temp)
			  {
				printf("%s\n",s[k]);
				for(z=k+1;z<=len-n;z++)
				{
					if(strcmp(s[k],s[z])==0)
					{
						strcpy(s[z],ch);
					}
				}
			  }
			}
		}
	}
	return 0;
}


int main(int argc, char* argv[])
{
	char str[501];
	char s[500][5];
	int n;
	scanf("%d",&n);
	scanf("%s",str);
	int i,j;
	int len=strlen(str);
	int num=len-n+1;
	for(i=0;i<num;i++){
		for(j=0;j<n;j++){
		s[i][j]=str[i+j];
		}
		s[i][j]='\0';

	}
	int total[500];
	for(i=0;i<500;i++){
	total[i]=1;
	}
	for(i=0;i<num-1;i++){
		for(j=i+1;j<num;j++){
	if(strcmp(s[i],s[j])==0) total[i]++;

	}
	}
	int max=2,shu=0,ji[500]={0},flag=0;
	for(i=0;i<num-1;i++){
		if(total[i]>=max){
			flag=1;
	max=total[i];
		}
	}
	for(i=0;i<num-1;i++){
		if(total[i]==max){
	ji[shu]=i;
	shu++;
	}}

	if(!flag) printf("NO\n");
	else {
		printf("%d\n",max);
		for(i=0;i<shu;i++){

	printf("%s\n",s[ji[i]]);
		}
	}

	return 0;
}


int main()
{
	int n,i,j,l;
	char s[MAX],zichuan[MAX][MAX],temp[MAX];        //temp?????????zichuan???????????
	scanf("%d",&n);
	getchar();
	gets(s);
	int len=strlen(s);
	int k=0;                           //k+1?????????
	int count[500]={0};                    //?zichuan??????????????
	for (j=0;j<n;j++)
	{
		zichuan[0][j]=s[j];
	}
	zichuan[0][n]=0;
	int flag;
	for (i=1;i<=len-n;i++)
	{
		flag=0;
		for (j=0;j<n;j++)
		{
			temp[j]=s[j+i];
		}
		temp[n]=0;
		for (l=0;l<=k;l++)
		{
			if (strcmp(zichuan[l],temp)==0)
			{
				count[l]++;        //?????\0???
				flag=1;            //???????????????
				break;
			}
		}
		if (flag!=1)            //flag?????????????
		{
			k++;
			strcpy(zichuan[k],temp);
		}
	}
	int maxcount=0;
	for (i=0;i<=k;i++)
	{
		if (count[i]>maxcount)
			maxcount=count[i];
	}
	maxcount++;
	if (maxcount==1)
		printf("NO");
	else
	{
		printf("%d\n",maxcount);
		for (i=0;i<=k;i++)
		{
			if (count[i]==maxcount-1)
				printf("%s\n",zichuan[i]);
		}
	}
	return 0;
}


int main()
{
 char ori[500], a[500][6];
 int num[500] = {0}, i, n, j, count = 0;
 scanf("%d", &n);
 scanf("%s", ori);
 int l = strlen(ori);
 for(i = 0; i < l - n + 1; i++)
 {
  char tmp[6];
  for(j = 0; j < n; j++)
  {
   tmp[j] = ori[i + j];
  }
  tmp[j] = '\0';
  int found = 0;
  for(j = 0; j < count; j++)
  {
   if(strcmp(a[j], tmp) == 0)
   {
    found = 1;
    num[j]++;
    break;
   }
  }
  if(found == 0)
  {
   for(j = 0; j <= n; j++)
   {
    a[count][j] = tmp[j];
   }
   num[count]++;
   count++;
  }
 }
 int max = 0;
 for(i = 0; i < count; i++)
 {
  if(num[i] > max) max = num[i];
 }
 if(max == 1)
 {
  printf("NO");
  return 0;
 }
 printf("%d\n", max);
 for(i = 0; i < count; i++)
 {
  if(num[i] == max)
   printf("%s\n", a[i]);
 }

 return 0;
}


main()
{
    int n,len,stre[1000],y,max=1;
    char str[1000][1000],stra[1000];
    scanf("%d%s",&n,stra);
    len=strlen(stra);
    for (int i=0;i<=len-n;i++)
    {
        for (int j=0;j<n;j++)
            str[i][j]=stra[i+j];
    }
    //?????~
    memset(stre, 0, sizeof(stre));
    for (int i=0;i<len-n;i++)
        for (int j=i;j<=len-n;j++)
        {
            y=strcmp(str[i],str[j]);
            if(y == 0)
                stre[i]++;
        }
    for(int i=0;i<len-n;i++)
    {
        if(stre[i]>max)
            max=stre[i];
    }
    if (max==1)
        printf("NO");
    else
    {
        printf("%d\n",max);
        for(int i=0;i<len-n;i++)
        {
            if (stre[i]==max)
            {
                for(int j=0;j<n;j++)
                    printf("%c",str[i][j]);
                printf("\n");

            }

        }
    }
}


int main()
{
	int maxflag,max,flag[500];
	char ch[500][500],str[500];
	int i,j,l,n;
	for(i=0;i<500;i++)
		flag[i]=1;
	scanf("%d",&n);
	getchar();
	gets(str);
	l=strlen(str);
	for(i=0;i<=l-n;i++)
	{
		for(j=i;j<i+n;j++)
		{
			ch[i][j-i]=str[j];
		}
	}
	maxflag=0;
	int count[500];
	for(i=0;i<=l-n;i++)
	{
		count[i]=0;
		if(flag[i]!=0)
		{
			for(j=0;j<=l-n;j++)
			{
				if(strcmp(ch[i],ch[j])==0&&i!=j)
				{
					count[i]++;
					flag[j]=0;
				}
			}
		}
		count[i]++;
		if(count[i]>maxflag)
		{
			maxflag=count[i];
		}
	}
	if(maxflag!=1)
	{
		printf("%d\n",maxflag);
		for(i=0;i<=l-n;i++)
		{
			if(count[i]==maxflag&&flag[i]!=0)
				printf("%s\n",ch[i]);
		}
	}
	else printf("NO");
}


int main()
{
	char str[510], div[510][5], *p;
	int times[510] = {0}, n, len, *q;
	int i, j, k, max, cnt;
	cin >> n;
	cin.get();
	cin.getline(str, 510);
	len = strlen(str);
	p = str;
	q = times;
	for(i = 0; i < len-n+1; i++)
		for(cnt = 0, k = i; cnt <= n; k++, cnt++)
		{
			if(cnt == n)
				div[i][k-i] = '\0';
			else
				div[i][k-i] = *(p+k);
		}
	for(i = 0; i < len-n+1; i++)
	{
		if(*(q+i) < 0)
			continue;
		*(q+i) += 1;
		for(j = i+1; j < len-n+1; j++)
		{
			if(strcmp(div[i], div[j]) == 0)
			{
				*(q+i) += 1;
				*(q+j) = -1;
			}
		}
	}
	max = 0;
	for(i = 0; i < len-n+1; i++)
		max = (max > *(q+i) ? max : *(q+i));
	if(max <= 1)
		cout << "NO"<< endl;
	else
	{
		cout << max << endl;
		for(i = 0; i < len-n+1; i++)
			if(*(q+i) == max)
				cout << div[i] << endl;
	}
	return 0;
}


int main()
{
	int n,m,i,j;
	char str[1000],str1[1000][20];
	scanf("%d",&n);
	scanf("%s",str);
	m=strlen(str);
	int index=0;
	for(i=0;i<(m-n+2);i++)
	{
		for(j=0;j<n;j++)
		{
			str1[i][j]=str[i+j];
		}
		index=i;
	}
	for(i=0;i<index;i++)
		str1[i][n]=0;
	int num[1000]={0},max;
	for(i=0;i<index;i++)
	{
		for(j=i;j<index;j++)
		{
			if(strcmp(str1[i],str1[j])==0)
				num[i]++;
		}
	}
	max=1;
	for(i=0;i<index;i++)
	{
		if(max<=num[i])
		{
			max=num[i];
		}
	}
	if(max==1)
	{
		printf("NO");
	}
	else
	{
		printf("%d\n",max);
	for(i=0;i<index;i++)
	{
		if(max==num[i])
			printf("%s\n",str1[i]);
	}
	}
}


int main ()
{  int n,i,j,m,t,max;
    char mem[1000];
    int num[1000];
    for(i=0;i<1000;i++)
      num[i]=1;
    scanf("%d\n",&n);
    gets(mem);
    m=strlen(mem);
    for(i=0;i<=m-n;i++)
    {   if(num[i]!=0)
        {  for(j=i+1;j<=m-n;j++)
             {
                for(t=0;t<n;t++)
					if(mem[i+t]!=mem[j+t])  break;
                if(t==n) {num[j]=0;num[i]++;}
              }
          }
    }

   max=1;
   for(i=0;i<=m-n;i++)
      if(num[i]>max) max=num[i];
   if(max==1) {printf("NO\n"); return 0;}
   printf("%d\n",max);
   for(i=0;i<=m-n;i++)
   {   if(num[i]==max)
      {  for(j=0;j<n;j++)
         printf("%c",mem[i+j]);
         printf("\n");
      }
    }
  return 0;
}


char sentence[1000],word[1000][10];
int num[1000]={1},words,n,Max=0;

void seperate()   //????????n???????????
{int i,i1,j=0,k=0;
 for(i=0;sentence[i+n-1]!='\0';i++)
   {for(i1=0;i1<n;i1++) {word[k][j]=sentence[i+i1];j++;}
    if(j==n) {word[k][n]=='\0';j=0;k++;}
      }
 words=k;
}

void coun() //??????????
{int i,j;
 for(i=0;i<words;i++) if(num[i]!=0) for(j=i+1;j<words;j++) if(strcmp(word[i],word[j])==0) {num[j]=0;num[i]++;}
 for(i=0;i<words;i++) if(num[i]>Max) Max=num[i];  //?????
     }

int main()
{int i;
 cin>>n;
 cin>>sentence;
 seperate();
 for(i=0;i<1000;i++) num[i]=1;
 coun();
 if(Max<=1) cout<<"NO"<<endl;
 else{cout<<Max<<endl; for(i=0;i<words;i++) if(num[i]==Max) cout<<word[i]<<endl;}
 return 0;
    }


int main(){
    char a[502],p[502][7];int len,n,re[502],max=0;
    memset(re,0,sizeof(re));
    scanf("%d",&n);
    scanf("%s",&a);
    len=strlen(a);
    for(int i=0;i<len-n+1;i++){
            for(int j=0;j<n;j++)p[i][j]=a[i+j];
            p[i][n]=0;
            }
    for(int i=0;i<len-n;i++)
    for(int j=i+1;j<len-n+1;j++)
    if(strcmp(&p[i][0],&p[j][0])==0)
    re[i]++;
    for(int i=0;i<len-n+1;i++)
    if(re[i]>max){max=re[i];}
    if(0==max){printf("NO");return 0;}
    printf("%d\n",max+1);
    for(int i=0;i<len-n+1;i++)
    if(re[i]==max)printf("%s\n",&p[i][0]);
    return 0;
}


main()
{
	int n;
	int i,j,k,m,a;
	char str[N];
	int temp=0;
	int  num[N]={0};
	scanf("%d",&n);
	scanf("%s",str);
	for(i=0;i<strlen(str)-n;i++)
	{
		for(j=i+1;j<strlen(str)-n+1;j++)
		{
			if(str[i]==str[j])
			{
				for(k=1;k<n;k++)
				{
					if(str[i+k]==str[j+k])
					   temp++;
				}
				if(temp==(n-1))
				  num[i]++;
			}
			temp=0;
		}
	}
	a=0;
	for(m=0;m<strlen(str)-n;m++)
	{
		if(num[m]>a)
		  a=num[m];
	}
	if(a==0)
	  printf("NO");
	else
	{
		printf("%d\n",a+1);
		for(j=0;j<strlen(str)-n+1;j++)
	    {
	    	if(num[j]==a)
	    	{
	    		for(i=0;i<n-1;i++)
	    		{
	    			printf("%c",str[j+i]);
	    		}
	    		printf("%c\n",str[j+n-1]);
	    	}
	    }
	}
}


int main()
{
	char c[505], d[505][6], e[505][6];
	memset(c, 0, sizeof(c));
	memset(d, 0, sizeof(d));
	int n, tmp = 0, max = 0, temp = 0;
	cin >> n;
	cin.get();
	cin.getline(c, 505);
	for (int i = 0; i <= strlen(c) - n; i++)
	{
		for (int j = 0; j < n; j++)
		     d[i][j] = c[i + j];
	}
	for (int i = 0; i <= strlen(c) - n; i++)
	{
		tmp = 1;
		if (d[i][0] != 0)
		{
			for (int j = i + 1; j <= strlen(c) - n; j++)
		    {
			    if (strcmp(d[i], d[j]) == 0)
			    {
				    tmp++;
				    memset (d[j], 0, 6);
			    }
		    }
		}
		else continue;
		if (tmp > max)
		{
			max = tmp;
			temp = 0;
			memset(e, 0, sizeof(e));
			strcpy (e[temp], d[i]);
		}
		if (tmp == max)
		{
			strcpy (e[temp], d[i]);
			temp++;
		}
	}
	if (max == 1) cout << "NO" << endl;
	else
	{
		cout << max << endl;
	    for (int i = 0; i < temp; i++)
	    {
		    cout << e[i] << endl;
	    }
	}
	return 0;
}


char str[510];
char gram[1000][6];
int sum[1000];

int main()
{
	int n, length, i, j, max, flag = -1, pos;
	cin >> n;
	cin.ignore();
	cin.getline(str, 500);
	length = strlen(str);
	//cout << length << endl;
	for (i = 0; i < length-n+1; i++)
		for (j = 0; j < n; j++)
			gram[i][j] = str[i+j];
	for (i = 0; i < 100; i++)
		sum[i] = 1;
	for (i = 0; i < length-n+1; i++)
	{
		if (gram[i][0] == '0')
			continue;
		for (j = i+1; j < length-n+1; j++)
		{
			if ((strcmp(gram[j], gram[i])) == 0)
			{
				sum[i]++;
				gram[j][0] = '0';
				sum[j] = 0;
			}
		}
	}
	max = 1;
	for (i = 0; i < length-n+1; i++)
	{
		if (sum[i] > max)
		{
			max = sum[i];
			flag++;
			pos = i;
		}
	}
	if (flag == -1)
		cout << "NO" << endl;
	else
	{
		cout << max << endl;
		for (i = 0; i < length-n+1; i++)
		{
			if (sum[i] == sum[pos])
				cout << gram[i] << endl;
		}
	}
	return 0;
}


struct string{
	char a[6];
	int num;
}sub[1000];
void main()
{
	char str1[10],str[1000];
	int n;
	int i,j,k,l;
	int jishu,zonshu1=0,zonshu2=0;
	int max;
	int len;
	scanf("%d",&n);
	gets(str1);
	gets(str);
	for(i=0;i<n;i++) sub[999].a[i]='0';
	len=strlen(str);
	for(i=0;i<=len-n;i++)
	{
		for(j=0;j<n;j++) {sub[i].a [j]=str[i+j];sub[i].num=0;}
		for(k=0;k<=len-n;k++)
		{
			jishu=0;
			for(l=0;l<n;l++)
			{
				if(str[k+l]==sub[i].a[l]) jishu++;
			}
			if(jishu==n) sub[i].num++;
		}
	}
	max=sub[0].num;
    for(i=0;i<=len-n;i++) max=(max>sub[i].num)?max:sub[i].num;
	if(max==1) printf("NO");
	else
	{
	for(i=0;i<=len-n;i++) {if(sub[i].num==max) zonshu1++;}
    for(i=0;i<=len-n;i++)
	{
		if(strcmp(sub[i].a,sub[999].a)!=0&&sub[i].num==max)
		{
			for(j=i+1;j<=len-n;j++)
			{
				if(strcmp(sub[j].a,sub[i].a)==0&&sub[j].num==max)
				 strcpy(sub[j].a,sub[999].a);
			}
		}
	}
	for(i=0;i<=len-n;i++)
		if(strcmp(sub[i].a,sub[999].a)!=0&&sub[i].num==max) zonshu2++;
	printf("%d\n",zonshu1/zonshu2);
	for(i=0;i<=len-n;i++)
		if(strcmp(sub[i].a,sub[999].a)!=0&&sub[i].num==max) printf("%s\n",sub[i].a);
	}
}


int main()
{
    int n,len,i,j,k,num[600]={0},flag;
    char chuan[600]={'\0'},cha[600][7]={'\0'},comp[7]={'\0'};
    cin>>n>>chuan;
    len=strlen(chuan);
    for(i=0;i<=(len-n);i++)
    {
        k=0;
        for(j=i;j<i+n;j++)
        {
            comp[k]=chuan[j];
            k++;
        }
        j=0;flag=0;
        while(num[j]!=0)
        {
            if(strcmp(comp,cha[j])==0)
            {
                num[j]++;
                flag=1;
                break;
            }
            j++;
        }
        if(flag==0)
        {
            for(k=0;k<n;k++)
               cha[j][k]=comp[k];
            num[j]++;
        }
    }
    i=0;  while(num[i]!=0){i++;}     len=i;
    for(i=0;;i++)
    {
        if(num[i]==0)  break;
        for(j=1;j<len-i;j++)
        {
            if(num[j]==0)   break;
            if(num[j-1]<num[j])
            {
                k=num[j-1];   num[j-1]=num[j];   num[j]=k;
                strcpy(comp,cha[j-1]);    strcpy(cha[j-1],cha[j]);   strcpy(cha[j],comp);
            }
        }
    }
    if(num[0]==1)     cout<<"NO"<<endl;
    else{
    i=0;  cout<<num[0]<<endl;
    while(num[i]==num[0])
    {
        cout<<cha[i]<<endl;
        i++;
    }
        }

    return 0;
}


int main ()
{ char num[400];
  char num1[400][400];
  int  sum[400];
  int i,n,j,t,m,s,max;
  scanf("%d\n",&n);
  gets(num);
  m=strlen(num);
  for(i=0;i<400;i++)
	  sum[i]=1;
  for(i=0;i<=m-n;i++)
	  for(j=i;j<i+n;j++)
		  num1[i][j-i]=num[j];
  for(i=0;i<=m-n;i++)
  {  t=0;
     if(sum[i]!=0)
	 { for(j=0;j<=m-n;j++)
	 {  for(s=j;s<j+n;s++)
	      if(num[s]!=num1[i][s-j]) break;
		  if(s==j+n) {t++;sum[j]=0;}
	 }
	 sum[i]=t;
	 }
  }
  max=1;
  for(i=0;i<=m-n;i++)
	  if(sum[i]>max) max=sum[i];
  if(max!=1)
  {  printf("%d\n",max);
	  for(i=0;i<m-n;i++)
     if(sum[i]==max)
	 { for(j=0;j<n;j++)
	   printf("%c",num1[i][j]);
	   printf("\n");
	 }
  }
  else printf("NO");
return 0;
}


void main()
{
	int n,i,k,num,max=0,len,count[1000]={0};
	char s[1000],zi[500][6],now[6];
	scanf("%d",&n);
	scanf("%s",s);
	len=strlen(s);

	for(i=0;i<n;i++)
		zi[0][i]=s[i];
	zi[0][i]='\0';
	count[0]=1;

	num=1;

	for(i=1;i<len-n+1;i++)
	{
		for(k=0;k<n;k++)
			now[k]=s[i+k];
		now[k]='\0';
		int p=0;
		while((p<num)&&(strcmp(now,zi[p])!=0))
		p++;
		if(p<num) count[p]++;
		else {
			count[num]=1;
			strcpy(zi[num],now);
			num++;
		}
	}
	for(i=0;i<num;i++)
	{
		if(count[i]>max)
			max=count[i];

	}
	if(max>1)
	{

	printf("%d\n",max);

	for(i=0;i<num;i++)
	{
		if(count[i]==max)
		{
			puts(zi[i]);

		}
	}
	}
	else printf("NO");
}


int main()
{  int max=0,temp=1,i,j,k=0,len,n;
char total[600],a[500][6]={'\0'},tall[20][6]={'\0'};
   scanf("%d",&n);getchar();
   gets(total);
   len=strlen(total);
   for(i=0;i<len-n+1;i++)
	   for(j=0;j<n;j++)
		   a[i][j]=total[i+j];
   for(i=0;i<len-n+1;i++)
   {for(j=i+1;j<len-n+1;j++)
   if(strcmp(a[i],a[j])==0) temp++;if(temp>max) max=temp;temp=1;}
     for(i=0;i<len-n+1;i++)
   {for(j=i+1;j<len-n+1;j++)
   if(strcmp(a[i],a[j])==0) temp++;if(temp==max) strcpy(tall[k],a[i]),k++;temp=1;}
	if(max==1) printf("NO");
else{ printf("%d\n",max);
	 for(i=0;i<k;i++)
		 puts(tall[i]);}
	 return 0;
}


char str[501][5];
char a[501];
int main(int argc, char* argv[])
{
    int n,m,k=0,i,j;
	char temp[5];
	int b[501];
	int max=0;
	scanf("%d\n",&n);
	gets(a);
	//puts(a);
    m=strlen(a);
	for(i=0;i<=m-n;i++)
	{
	   for(j=i;j<i+n;j++)   str[i][j-i]=a[j];
	   b[i]=1;
	}
   for(i=0;i<=m-n;i++)
   {
	  for(j=i+1;j<=m-n;j++)
	   if(strcmp(str[i],str[j])==0)  b[i]++;
	  if(b[i]>max)  max=b[i];
   }
    if(max==1)   printf("NO");
	else if(max>1)
	{
    printf("%d\n",max);
	for(i=0;i<=m-n;i++)
	  if(b[i]==max)
	  {
	   printf("%s",str[i]);
	   printf("\n");
	  }
    }
	return 0;
}


int n,l,i,j,f[1000],tm,tn,tt;
char c[1000];
int st(int s,int t)
{
    int k;
    for(k=0;k<n;k++)
       if(c[s+k]!=c[t+k])
                   return 0;
    return 1;
}

int main()
{
    scanf("%d%s",&n,c);
    l=strlen(c);
    for(i=l-n;i>=0;i--)
    {
        for(tt=0,j=i;j<=l-n;j++)
            if(st(i,j))
                tt++;
        if(tt>tm)f[0]=1,f[1]=i,tm=tt;
        else if(tt==tm)f[++f[0]]=i;
    }
    if(tm>1)
    {    printf("%d\n",tm);
    for(i=f[0];i;i--,printf("\n"))
        for(j=0;j<n;j++)
            printf("%c",c[f[i]+j]);
    }
    else
        printf("NO");
    return 0;
}


char w[600][6];
char a[600][6];
char k[600];
char t[6];
int l,n;
int cmp(const void *a,const void *b){
	return strcmp((char *)a,(char *)b);
}
int main(){
	scanf("%d\n",&n);
	memset(k,0,sizeof(k));
	cin.getline(k,500,'\n');
	l=strlen(k);
	for(int i=0;i<l-n+1;i++)
		memcpy(&w[i],&k[i],sizeof(char)*n);
	qsort(w,l-n+1,6*sizeof(char),cmp);
	int d[500];
	memset(d,0,sizeof(d));
	d[0]=1;
	int m=1;
	for(int i=1;i<l-n+1;i++){
		d[i]=strcmp(w[i],w[i-1])?1:d[i-1]+1;
		m=max(m,d[i]);
	}
	if(m==1){
		cout<<"NO"<<endl;
		return 0;
	}
	int tt=0;
	for(int i=0;i<l-n+1;i++)if(m==d[i]){
		strcpy(a[tt],w[i]);
		tt++;
	}
	cout<<m<<endl;
	for(int i=0;i<l-n+1;i++){
		memcpy(&t,&k[i],sizeof(char)*n);
		for(int j=0;j<tt;j++)
			if(!strcmp(t,a[j])){cout<<t<<endl;a[j][0]=0;}
	}

	return 0;
}