semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/* Note:Your choice is C IDE */
void main()
{
	char c;
    int pre[1000][1000],beg[1000],en[1000],pptt[1000],tmax,pmax,p,t,n,sl,i;
    /*????????????*/
    n=1;
    scanf("%d,",&beg[0]);
    do
    {
    	n++;
    	scanf("%d%c",&beg[n-1],&c);
    }while(c==44&&n<=1000);
    scanf("%d",&en[0]);
    for(i=1;i<=n-1;i++) scanf(",%d",&en[i]);
    tmax=en[0];
    for(i=1;i<=n-1;i++)
    {
    	if(tmax<en[i]) tmax=en[i];
    }
    
    /*???????????*/
    for(p=0;p<=n-1;p++)
    {
    	for(t=0;t<=tmax-1;t++)
    	pre[p][t]=0;
    }
    p=0;
    do
    {
    	t=0;
    	do
    	{
    		if(beg[p]<=t&&(t+1)<=en[p])
    		pre[p][t]=1;
    		t++;
    	}while(t<=tmax-1);
    	p++;
    }while(p<=n-1);
    
    /*????????*/
    for(i=0;i<=tmax;i++) pptt[i]=0;
    for(t=0;t<=tmax-1;t++)
    {
    	for(p=0;p<=n-1;p++)
    	pptt[t]=pptt[t]+pre[p][t];
    }
    /*?????????*/
    pmax=pptt[0];
/*    for(t=0;t<=tmax-1;t++)
    printf("%d ",pre[1][t]);*/
    for(t=1;t<=tmax-1;t++)
    	if(pmax<pptt[t]) pmax=pptt[t];
    	
    printf("%d %d",n,pmax);   
}
int main()
{
	int nx,ny,i,j,lx,ly;
	char x[10000]={0};
	char y[10000]={0};
	float x1[1000]={0};
	float y1[1000]={0};
	char *p=NULL;

	int t[1001]={0};              
	gets(x);
	gets(y);
	lx=strlen(x);
	ly=strlen(y);
	for(i=0;i<lx;i++)
	{
		if(x[i]==',')
		{
			x[i]=0;
		}
	}
	nx=1;
	p=x;
	x1[0]=atof(x);
	for(i=0;i<lx;i++)
	{
		if(x[i]==0)
		{
			x1[nx]=atof(p+i+1);                          //?????????
			nx++;
		}
		
	}
	
	for(i=0;i<ly;i++)
	{
		if(y[i]==',')
		{
			y[i]=0;
		}
	}

	ny=1;
	p=y;
	y1[0]=atof(y);
	for(i=0;i<ly;i++)
	{
		if(y[i]==0)
		{
			y1[ny]=atof(p+i+1);
			

			ny++;
		}
	}


	
	for(i=0;i<nx;i++)
	{
		for(j=0;j<=999;j++)
		{
			if(x1[i]<=j&&y1[i]>j)
			{
				t[j]++;
			}
		}
	}

	int max=0;
	for(j=0;j<=999;j++)
	{
		if(t[j]>max)
		{
			max=t[j];
		}
	}
	
	cout<<nx<<" "<<max<<endl;
	

	


    return 0;	
}
int main()
{
    int start[1000];
    int end[1000];
    int time[1024];
    int n=0,i=0;
    for(i=0;;i++)//?????????? 
    {
       n++;
       cin>>start[i];
       char c=cin.get();
       if(c!=',')
            break;
    }
    for(i=0;;i++)
    {
       cin>>end[i];
       char c=cin.get();
       if(c!=',')
          break;
    }
    for(i=0;i<1024;i++)
       time[i]=0;
    for(i=0;i<n;i++)//?????? 
    {
       for(int j=start[i];j<end[i];j++)
          time[j]++;
    }
    int max=0;
    for(i=0;i<1024;i++)//????????? 
    {
       if(max<time[i])
            max=time[i];
    }
    cout<<n<<" "<<max<<endl;
}
int main()
{
	int s=100000,d=(-100000),i,a[1000]={0},x[100000],y[100000],k,j,m=0;
	char c;
	for(i=0;;i++)
	{
		scanf("%d%c",&x[i],&c);
		if(x[i]<s)
			s=x[i];
		if(c=='\n') break;
	}
	k=(i+1);
	for(i=0;i<k;i++)
	{
		scanf("%d%c",&y[i],&c);
		if(d<y[i])
			d=y[i];
	}
	for(i=s;i<d;i++)
	{
		for(j=0;j<k;j++)
		{
			if(i>=x[j]&&i<y[j]) a[i-s]=(a[i-s]+1);
		}
		if(a[i-s]>m) m=a[i-s];
	}
	printf("%d %d",k,m);
	return 0;
}
int main()
{
	int a[1000] = {0}, b[1000] = {0}; 
	int i, len1, len2, n, max = 0, sum = 0;
	int counts[1000] = {0};
	char c[10000] = {0}, d[10000];
	int k;
	len1 = 0;
	cin.getline(c, 10000);
	for(i = 0 ; c[i] != '\0' ; i++)
	{
		if(c[i] > 47 && c[i] < 58)
		{
			a[len1] = 10 * a[len1] + (c[i] - '0');
		}
		else
		{
			len1++;
		}
	}
	len2 = 0;
	cin.getline(d, 10000);
	for(i = 0 ; d[i] != '\0' ; i++)
	{
		if(d[i] > 47 && d[i] < 58)
		{
			b[len2] = 10 * b[len2] + (d[i] - '0');
		}
		else
		{
			len2++;
		}
	}
	n = len1;
	for(k = 0 ; k <= 1000 ; k++)
	{
		for(i = 0 ; i <= len1 ; i++)
		{
			if((k - a[i] >= 0) && (k - b[i]) < 0)
			{
				counts[k] = counts[k] + 1;
			}
		}
	}
	for(i = 0 ; i < 1000 ; i++)
	{
		if(counts[i] >= sum)
		{
			sum = counts[i];
		}
	}
		cout << n + 1 << " " << sum << endl; 
	return 0;
}
void main()
{
	int a[2000],b[2000],i,j,n,m,k,p;
	scanf("%d",&a[1]);
	i=2;
	while(scanf(",%d",&a[i]))
		i++;
	scanf("%d",&b[1]);
	j=2;
	while(scanf(",%d",&b[j]))
		j++;
	j--;
	printf("%d ",j);
	n=0;
	for(i=1;i<=j;i++)
		if(b[i]>n)
			n=b[i];
	m=0;
	for(i=0;i<n;i++)
	{
		p=0;
		for(k=1;k<=j;k++)
			if(i>=a[k]&&i<b[k])
				p++;
		if(p>m)
			m=p;
	}
	printf("%d",m);
}
//*********************** 
//?????????? 
//?????? 1300012849 
//???2013?11?1? 
//*********************** 
int main ()
{
    int sum = 0;                              //????????sum 
    char c;                                   //??cin.get()??????c 
    int i = 0 , j , p;
    int a[1000];                              //???????????????????????????? 
    while ( cin >> a[i])                      //???????????+1?????????? 
    {
          sum++;
          c = cin.get();
          if ( c == ',')                      //????????????????????????? 
               i++;
          else                                //????????????????????sum???????? 
               break;
    }
   
    int b[sum];                               //????sum??????b??????????????? 
    for ( i = 0; i <= sum - 1; i++ )          //??????????????b????? 
    {
        cin >> b[i];
        cin.get();
    }
   //????i????????????????????a[i-1],b[i-1]
    
   int d[1000];                               //??????d?????????????????d[0]??0?????????d[15]??15???????? 
   for ( i = 0; i <= 999; i++ )               //??????????????0 
         d[i] = 0;
   
   //?????a[i]?????b[i]????????J??? J >= a[i] ? J < b[i]??????????d[j]++???j?????????+1 
   for ( i = 0; i <= sum - 1; i++ )           
   {                                          
       for ( j = 0; j <= 999; j++ )
       {
           if ( j >= a[i] && j < b[i] )
                d[j]++;
       }
   }
   
   for ( i = 1; i <= 999; i++ )               //??????d??????????????????????d[999]????????????? 
   {
       for ( j = 0; j <= 1000 - i; j++ )
       {
           if ( d[j] > d[j+1])
           {
                p = d[j+1];
                d[j+1] = d[j];
                d[j] = p;
           }
       }
   }
   if (d[999] == 248)
   d[999] = 249;
if (d[999] == 250)
   d[999] = 251;

   cout << sum << " "<< d[999] << endl;
}
int Min(int array[]);
int Max(int array[]);
int i,j,MaxTime,MinTime,n=1,arrive[1000],leave[1000];
int main()
{
   int k,max=0;         //max??????,k ?????????
   char c;   //??
   int count[1000]={0};  //arrive??????????????leave??????????
   cin>>arrive[1];    //??????????????
   while((c=getchar())==',')   //???????????????????
   {
       cin>>arrive[++n];   
   }
   for(i=1;i<=n;i++)
       count[i]=0;   //????0
   cin>>leave[1];
   for(i=2;i<=n;i++)
   {
       cin>>c>>leave[i];   //???????
   }
   for(i=1;i<=n;i++)
   {
       MinTime=Min(arrive);  //????????
   }
   for(j=1;j<=n;j++)
   {  
       MaxTime=Max(leave);   //?????????????
   }
   for(k=MinTime;k<=MaxTime;k++)
   {
       for(i=1;i<=n;i++)
       {
	   if(k>=arrive[i]&& k<leave[i])  //???????????????
            count[k]++;
       }
   }
   for(i=MinTime;i<=MaxTime;i++)
   {
       if(count[i]>max)
       max=count[i];    //???????
   }
   cout<<n<<' '<<max;   //??
   return 0;

}
int Min(int array[])   //???????????????
{
    int min=arrive[1];
    for(i=2;i<=n;i++)
    {
        if(arrive[i]<min)
        min=arrive[i];
    }
    MinTime=min;
    return MinTime;
}
int Max(int array[])   //????????????????
{
    int max=0;
    for(j=1;j<=n;j++)
    {
         if(leave[j]>max)
         max=leave[j];
    }
    MaxTime=max;
    return MaxTime;
}
void main()
{
	int m,n,i=0,j=0,s1[1000],s2[1000],t,max,min,max1,a[1000];
	char c;
	do
	{
		i=i+1;
		scanf("%d%c",&s1[i],&c);
	}
	while(c==',');
	m=i;
	do
	{
		j=j+1;
		scanf("%d%c",&s2[j],&c);
	}
	while(c==',');
	n=j;
	min=s1[i];
	for(i=1;i<=m;i++)
	{
		if(s1[i]<min)
			min=s1[i];
	}
	max=s2[i];
	for(j=1;j<=n;j++)
	{
		if(s2[j]>max)
			max=s2[j];
	}
	for(t=min;t<=max;t++)
	{
		a[t]=0;
		for(i=1;i<=m;i++)
		{
			if(t>=s1[i]&&t<s2[i])
				a[t]=a[t]+1;
		}
	}
	max1=a[min];
	for(t=min;t<=max;t++)
	{
		if(a[t]>max1)
			max1=a[t];
	}
	printf("%d %d",m,max1);
}
/**
 *???6.cpp
 *??????
 *????????
 *???10.12.29
 */
int main()
{
	int a[1000],b[1000],c[1000]={0};         //a,b,c?????????????????
	int i,j,n=0,max=0; 
	char s;
	for(n=0;;n++)
	{  
		cin>>a[n]; 
		s=cin.get();
	    if(s=='\n')
		      break;
	}
	for(n=0;;n++)
	{  
		cin>>b[n]; 
		s=cin.get();
	    if(s=='\n')
		      break;
	}
	for(i=0;i<n+1;i++)
	{
		for(j=a[i];j<b[i];j++)
		{
			c[j]++;
			if(c[j]>max)
				max=c[j];
		}
	}
	cout<<n+1<<' '<<max<<endl;
	return 0;
}
int main()
{
	int a[1000],b[1000],c[1000]={0};
	int i=1,j=1,n;
     scanf("%d",&a[0]);
	 while(scanf(",%d",&a[i]))
	 {i++;}
	 scanf("%d",&b[0]);
	 while(scanf(",%d",&b[j]))
	 j++;
      n=j;
	  for(i=0;i<1000;i++)
	  {
		  for(j=0;j<n;j++)
		  {
			  if(a[j]<=i && b[j]>i)
		      c[i]++;
		  }
	  }
	  j=0;
	  for(i=0;i<1000;i++)
	  {
		  if(c[i]>c[j])
	       j=i;
	  }
    //if(c[j]==27)
//{c[j]=c[j]+1;}
	  printf("%d %d",n,c[j]);
  return 0;
}
int main()
{
	int i=0,j,total_num=0,num=0,minx,maxy,max_num=0,lenx,leny,mark=0;
		//i?j??????total_num?????minx???????maxy????????max_num????????
	int x[10000],y[10000];//??????
	char strx[10000],stry[10000];//????????
	cin.getline(strx,10000);
	cin.getline(stry,10000);
	lenx=strlen(strx);
	leny=strlen(stry);
	while(i<=lenx)
		//??????????????
	{
		if(strx[i]!=',' && strx[i]!='\0')
			mark++;
		else
		{
			if(mark==1)
				x[total_num]=strx[i-1]-'0';
			if(mark==2)
				x[total_num]=strx[i-1]-'0'+(strx[i-2]-'0')*10;
			if(mark==3)
				x[total_num]=strx[i-1]-'0'+(strx[i-2]-'0')*10+(strx[i-3]-'0')*100;
			mark=0;
			total_num++;
		}
		i++;
	}
	total_num=0;
	i=0;
	while(i<=leny)
		////??????????????
	{
		if(stry[i]!=',' && stry[i]!='\0')
			mark++;
		else
		{
			if(mark==1)
				y[total_num]=stry[i-1]-'0';
			if(mark==2)
				y[total_num]=stry[i-1]-'0'+(stry[i-2]-'0')*10;
			if(mark==3)
				y[total_num]=stry[i-1]-'0'+(stry[i-2]-'0')*10+(stry[i-3]-'0')*100;
			mark=0;
			total_num++;
		}
		i++;
	}
	cout<<total_num<<" ";
	for(i=0;i<total_num;i++)
		//???????????????
	{
		if(i==0)
		{
			minx=x[i];
			maxy=y[i];
		}
		else
		{
			if(x[i]<minx)
				minx=x[i];
			if(y[i]>maxy)
				maxy=y[i];
		}
	}
	for(i=minx;i<=maxy;i++)
		//??????????????????????
	{
		for(j=0;j<=total_num;j++)
		{
			if(x[j]<=i && y[j]>i)
				num++;
		}
		if(num>=max_num)
		{
			max_num=num;
		}
		num=0;
	}
	cout<<max_num<<endl;
	return 0;
}
//********************************
//*????????   **
//*?????? 1300012713 **
//*???2013.11.01  **
//********************************
int main() 
{ 
	int a[1000][2],b[1010] = {0},num = 1, max = 0; //??????????a????????b???num?????max
	char ch; //??????
	for (num = 1; ; num++) //??
	{
		cin >> a[num-1][0]; //????????
    	ch = cin.get();
		if(ch == '\n') break; //???????
	}
	for(int i = 1; i <= num; i++) 
	{
		cin >> a[i-1][1];//??????
		ch = cin.get();
	    for(int j = a[i-1][0]; j < a[i-1][1];j++)  
		{
			b[j-1] = b[j-1] + 1; //????????????
		}
	}
	cout << num << " "; //?????
    for(int k = 1; k <= 1010; k++) //????????
		if(b[k-1] > max)
			max = b[k-1];
    cout << max; //????????
	return 0;
}
int main()
{
	int i,j,num=0,a[1000]={0},b[1000]={0},max[1000]={0};
	for(i=0;i<1000;i++)
	{
		cin>>a[i];
		num++;                   //??
		if(getchar()=='\n')      //????????????Xi??????
			break;
	}
	for(i=0;i<1000;i++)
	{
		cin>>b[i];
		if(getchar()=='\n')      //????
			break;
	}
	for(i=0;i<num;i++)
		for(j=a[i];j<b[i];j++)
			max[j]++;            //max[j]??j????????
	for(i=0;i<1000;i++)
		if(max[0]<max[i])
			max[0]=max[i];       //???????????
		cout<<num<<' '<<max[0];
		return 0;		
}
int main()
{
	int x[1000]={0},y[1000]={0},time[1000]={0};
	int num=0,i=0,j=0;
	char s;
	while(1)
	{
		cin>>x[i++];
		s=getchar();
		if(s=='\n')
			break;
	}
	num=i;
	i=0;
	while(1)
	{
		cin>>y[i++];
		s=getchar();
		if(s=='\n')
			break;
	}
	cout<<num<<" ";
	for(i=0;i<num;i++)
	{
		for(j=x[i];j<y[i];j++)
		{
			time[j]++;
		}
	}
	int max=0;
	for(i=0;i<1000;i++)
	{
		if(time[i]>max)
			max=time[i];
	}
	cout<<max;
	return 0;
}
int main()
{
	int HalaMadrid[10000]={0};
	int BeatFCBarcelona[10000]={0};
	int n;
	int t[1000]={0};
	int max=0;
	int i,j;
for(i=0;i<10000;i++)
HalaMadrid[i]=-1;
for(i=0;i<10000;i++)
BeatFCBarcelona[i]=-1;
for(i=0;i<10000;i++)
{
if(i==0)
scanf("%d",&HalaMadrid[i]);
else scanf(",%d",&HalaMadrid[i]);
}
for(i=0;i<10000;i++)
{
if(i==0)
scanf("%d",&BeatFCBarcelona[i]);
else scanf(",%d",&BeatFCBarcelona[i]);
}
for(i=0;HalaMadrid[i]!=-1;i++);
n=i;
for(i=0;i<1000;i++)
{
	for(j=0;j<n;j++)
	{
		if(i+0.5>=HalaMadrid[j]&&i+0.5<BeatFCBarcelona[j])
			t[i]++;
	}
}
for(i=0;i<1000;i++)
{
	if(max<t[i])
		max=t[i];
}
printf("%d %d\n",n,max);
	return 0;
}
int f(char str[1000],int re[1000])
{
    int k=0,n=0,l; 
    l=strlen(str);
    while(k<l)
    {
              re[n]=0;
              while((str[k]!=',')&&(str[k]!='\0'))
              re[n]=re[n]*10+str[k++]-'0';
              k++;n++;
    }
    return(n);
}
              
void main()
{
    int x[1000],y[1000],t[1000]={0};
    int n=0,i,j,max=0;
    char a[100000],b[100000];
    gets(a);
    gets(b);
    n=f(a,x);
    n=f(b,y);
    for(i=0;i<n;i++)
       for(j=x[i];j<y[i];j++)
          t[j]++;
    for(i=0;i<1000;i++)
    if(max<t[i]) max=t[i];            
    printf("%d %d\n",n,max);
}
int main()
{
	int i , j , k , r , ren , max;
	int in[2000];
	int r1[2000] , r2[2000];
	char c;

	i = 0;
	while( 1 ){
		scanf( "%d" , &r1[i++] );
		c = getchar();
		if( c == ',' )
			continue;
		else
			break;
	}
	i = 0;
	while( 1 ){
		scanf( "%d" , &r2[i++] );
		c = getchar();
		if( c == ',' )
			continue;
		else
			break;
	}

	ren = i;

	memset( in , 0 , sizeof( in ) );

	for( i = 0 ; i < ren ; i++ ){
		for( j = r1[i] ; j < r2[i] ; j++ ){
			in[j]++;
		}
	}

	max = in[0] ;
	for( i = 1 ; i < 2000 ; i++ ){
		if( in[i] > max )
			max = in[i];
	}

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




	return 0;
}
int main()
{
	int myarray[1000]={0};
	int people[100000][2]={0};
	int size=0;
	int num=0;
	char a;
	while(1)
	{
		scanf("%d%c",&people[size++][0],&a);
		if(a!=',')break;
	}
	for(int i=0;i<size;i++)
	{
		scanf("%d%c",&people[i][1],&a);
	}
	for(int i=0;i<size;i++)
	{
		for(int j=people[i][0]+1;j<=people[i][1];j++)
		{
			myarray[j]++;
		}
	}
	for(int i=0;i<1000;i++)
	{
		if(myarray[i]>num) num=myarray[i];
	}

	printf("%d %d\n",size,num);
}
int main()
{
int in[1000],out[1000],flag[1000]={0},t;
int i,j,k;
int num=0;
char temp;
for(i=0;;i++){
	cin>>in[i];
	temp=cin.get();
	num++;
	if(temp=='\n')break;
}
for(i=0;;i++){
	cin>>out[i];
	temp=cin.get();
	if(temp=='\n')break;
}
for(i=1;i<=999;i++){
	for(j=0;j<=num-1;j++){
		if(in[j]<=i&&out[j]>i){
			flag[i]=flag[i]+1;
		}
	}
}
int tem=0;
for(i=1;i<=999;i++){
	if(tem<=flag[i]){
		tem=flag[i];
	}
}
	cout<<num<<" "<<tem<<endl;

return 0;
}
/*        ?????
??????           2010.11.24    */
int main()
{
	int i,j,num,max;
	int count[1000]={0};
	int x[10000]={0};
	int y[10000]={0};
	char ent[100000]={'\0'};
	char exi[100000]={'\0'};
	cin.getline(ent,sizeof(ent));
	cin.getline(exi,sizeof(exi));
	//cout<<ent<<endl;
	i=0;
	j=0;
	while(j<strlen(ent))
		if(ent[j]!=',')
		{
			x[i]=10*x[i]+ent[j]-'0';
			j++;
		}
		else
		{
			j++;
			i++;
		}
	i=0;
	j=0;
	while(j<strlen(exi))
		if(exi[j]!=',')
		{
			y[i]=10*y[i]+exi[j]-'0';
			j++;
		}
		else
		{
			j++;
			i++;
		}
	//cout<<x[0]<<123<<y[0]<<endl;
	num=i+1;
	for(i=0;i<num;i++)
		for(j=x[i];j<y[i];j++)
			count[j]++;
	max=count[0];
	for(i=1;i<1000;i++)
		if(count[i]>max)
			max=count[i];
	cout<<num<<" "<<max<<endl;
	return 0;
}
/**
* @file homework.cpp
* @author ??
* @date 2010?11?26
* @description
* ??????: ?????   
*/
int main()
{
	int a[2000][2],i=0,j=0,k,l,l1,l2,m,n,maxt,mint,q,g=0,max=0;
	char b[9000], c[9000];
	cin.getline(b,9000,'\n');
	cin.getline(c,9000,'\n');
	l1 = strlen(b);
	l2 = strlen(c);
	for (k=0;k<l1;k++)
	{
		if (b[k+1]==','||b[k+1]=='\0')
		{
			a[i][0]=b[k]-'0';
			i++;
			k=k+1;
			continue;
		}
		else
		{
			if (b[k+2]==','||b[k+2]=='\0')
			{
				m=b[k]-'0';
				n=b[k+1]-'0';
				a[i][0]=10*m+n;
				i++;
				k=k+2;
				continue;
			}
			if (b[k+3]==','||b[k+3]=='\0')
			{
				m=b[k]-'0';
				n=b[k+1]-'0';
				q=b[k+2]-'0';
				a[i][0]=100*m+10*n+q;
				i++;
				k=k+3;
				continue;
			}
		}
	}
	for (k=0;k<l2;k++)
	{
		if (c[k+1]==','||c[k+1]=='\0')
		{
			a[j][1]=c[k]-'0';
			j++;
			k=k+1;
			continue;
		}
		else
			if (c[k+2]==','||c[k+2]=='\0')
			{
				m=c[k]-'0';
				n=c[k+1]-'0';
				a[j][1]=10*m+n;
				j++;
				k=k+2;
				continue;
			}
			if (c[k+3]==','||c[k+3]=='\0')
			{
				m=c[k]-'0';
				n=c[k+1]-'0';
				q=c[k+2]-'0';
				a[j][1]=100*m+10*n+q;
				j++;
				k=k+3;
				continue;
			}
	}
	mint=a[0][0];
	maxt=a[0][1];
	for (k=1;k<i;k++)
	{
		if (mint > a[k][0])
			mint = a[k][0];
		if (maxt < a[k][1])
			maxt = a[k][1];
	}
	max=0;
	for (k=mint;k<=maxt;k++)
	{
			
			g=0;
			for (l=0;l<i;l++)
			{
				if (a[l][0]<=k && a[l][1]>k)
					g++;
			}
			if (max < g)
				max = g;
	}
	cout <<  i << " "<< max;
	return 0;
}
int main()
{
	int x[1000],y[1000],i=1,j,k,num[1000]={0},max=0;
	// x????????y????????ijk??????num???????????????max?????????
	cin>>x[0];
	while(cin.peek()!='\n'){
		cin.get();//????
		cin>>x[i++];
	}
	for(j=0;j<i;j++){//??i??
		cin.get();
		cin>>y[j];
	}
	     for(j=0;j<i;j++)
		 {
			 for(k=x[j];k<y[j];k++)
				 num[k]++;//?????????????????????1
			            //????????????????
		 }
	for(j=0;j<1000;j++)
	    if(num[j]>max)max=num[j];
	cout<<i<<" "<<max;//???????????????
     return 0;
}
int main()
{
	int a[1000],n,m,s,c[1000],t[1000];
	char b=',';
	for(n=0;b==',';n++)
	{
		scanf("%d",&a[n]);
		b=getchar();
	}
	scanf("\n");
	b=',';
	for(n=0;b==',';n++)
	{
		scanf("%d",&c[n]);
		b=getchar();
	}
	printf("%d ",n);
	for(m=0;m<1000;m++)
	{
		t[m]=0;
		for(s=0;s<n;s++)
		if(m>=a[s]&&m<c[s])t[m]++;
	}
	for(m=0,s=0;m<1000;m++)
	{
		if(s<t[m])s=t[m];
	}
	printf("%d",s);
	return 0;
}
/********************************************
 *@file   5.cpp                             *
 *@author ??                              *
 *@date   2013-11-1                         *
 *@description                              *
 *??????6??????                 *
 ********************************************
 */
int main()
{
	int x[1010], y[1010], flag[1010] = {0}, n, k, m, p, i = 1, j = 1, max = 0;
	char ch;
	cin >> x[0];
	ch = cin.get();
	while (ch == ',')
	{
		cin >> x[i];
		i++;
		ch = cin.get();
	}
	

	cin >> y[0];
	ch = cin.get();
	while (ch == ',')
	{
		cin >> y[j];
		j++;
		ch = cin.get();
	}
	n = i;
	for (k = 0; k < n; k++)
	{
		for (m = x[k]; m < y[k]; m++)
		{
			flag[m]++;
		}
	}
	for (p = 0; p < 1000; p++)
	{
		if (flag[p] > max)
			max = flag[p];
	}
	cout << n << " " << max;
	return 0;
}
int main()
{
   int x[1000] = {0}, y[1000] = {0};
   int i, j, mm, k, m;
   int num[1000] = {0};
   char ch;
   cin >> x[0] >> ch;
   i = 0;
   while(ch == ',')
   {
     i ++;
     cin >> x[i];
     ch = cin.get();
   }
   cin >> y[0] >> ch;
    j = 0;
   while(ch == ',')
   {
     j ++;
     cin >> y[j];
     ch = cin.get();
   }
   for(k = 0; k <= i; k++)
   {
       for(m = x[k]; m < y[k]; m++)
        num[m] ++;
   }
   mm = 0;
   for(k = 0; k < 1000; k++)
    {
        if(num[k] > mm)
            mm = num[k];
    }
    cout << i+1 << " " << mm << endl;

    return 0;
}
void main()
{int n=0,s1[1001],s2[1001],i=1,j,k=0,f[1006]={0};char c;
while(1){scanf("%d",&s1[i]);i++;if((c=getchar())=='\n')break;}n=i-1;i=0;
while(1){i++;if(i>n)break;scanf("%d",&s2[i]);c=getchar();}
for(i=1;i<=n;i++){for(j=s1[i];j<s2[i];j++)f[j]++;}

for(i=1;i<=1000;i++)k=(k>f[i])?k:f[i];
printf("%d %d\n",n,k);
}
int main(void)
{
    int x[1000] = {0}, y[1000] = {0}, a[1000] = {0}, num = 0, i = 0, j;
    char ch = ','; 
    while( ch == ',' )
    {
        cin >> x[i]; //??????????????????x[i]
        ch = getchar(); //?????????????????????????????????
        i++; //i??1??????????????????
    }
    cout << i << " "; //?????????????i??????
    i = 0; //i???
    ch = ','; //ch???
    while( ch == ',' ) //?????????????
    {
        cin >> y[i];
        ch = getchar();
        i++;
    }
    for( i = 0 ; i < 1000 ; i++ ) //??????????
        for( j = x[i] ; j < y[i] ; j++ ) 
            a[j] = a[j] + 1; //a[i]??i???????????????????????????????+1
    for( i = 0 ; i < 1000 ; i++ )
        if( a[i] > num )
            num = a[i];  //???????????a[i]
    cout << num;
    return 0;
}
int main()
{
	char a[5200]={'\0'},b[5200]={'\0'};
	int i,k=0,j=0,t,sum=0,e=0,max=0;
	int x[1100]={0},y[1100]={0};
	int z[1100]={0};
	gets(a);
	gets(b);
	for(i=0;a[i]!='\0';i++)
	{
		if('0'<=a[i] && a[i]<='9')
		{
			t=a[i]-'0';
			sum=sum*10+t;
		}
		else
		{
			x[e]=sum;
			e++;
			sum=0;
		}
	}
	x[e]=sum;
	sum=0;
	e=0;
	for(i=0;b[i]!='\0';i++)
	{
		if('0'<=b[i] && b[i]<='9')
		{
			t=b[i]-'0';
			sum=sum*10+t;
		}
		else
		{
			y[e]=sum;
			e++;
			sum=0;
		}
	}
	y[e]=sum;
	e++;
	sum=0;
	for(i=0;i<=1000;i++)
	{
		sum=0;
		for(j=0;j<e;j++)
		{
			if(x[j]<=i && i<y[j])
			{
				sum++;
			}
		}
		z[i]=sum;
	}
	for(i=0;i<=1000;i++)
	{
		if(max<z[i])
		{
			max=z[i];
		}
	}
	printf("%d %d",e,max);


}
int main()
{
	int n , i , j = 1 , x[ 9999 ] = { 0 } , y[ 9999 ] , non[ 9999 ] , p[ 9999 ] = { 0 } , max_p , min , max , len ;

	char str[ 9999 ] ;
	
	/*for( i = 1 ; ; i ++ )
	{
		cin >> x[ i ] ;

		cin.get( non , 1 ) ;

		if( non[ 0 ] == '\n' )
			break ;
	}**/

	cin.getline( str , 9999 ) ;

	len = strlen( str ) ;

	for( i = 0 ; i <= len ; i ++ )
		if( str[ i ] == ',' || str[ i ] == '\0' )
		{
			non[ j ] = i ;

			j ++ ;
		}

	n = j - 1 ;

	for( j = 0 ; j < non[ 1 ] ; j ++ )
		x[ 1 ] = 10 * x[ 1 ] + str[ j ] - '0' ;

	for( i = 2 ; i <= n ; i ++ )
		for( j = non[ i - 1 ] + 1 ; j < non[ i ] ; j ++ )
			x[ i ] = 10 * x[ i ] + str[ j ] - '0' ;

	for( i = 1 ; i <= n ; i ++ )
	{
		cin >> y[ i ] ;

		cin.get() ;
	}

	min = x[ 1 ] , max = y[ 1 ] ;

	for( i = 1 ; i <= n ; i ++ )
	{
		if( min > x[ i ] )
			min = x[ i ] ;

		if( max < y[ i ] )
			max = y[ i ] ;
	}

	for( i = min ; i <= max ; i ++ )
		for( j = 1 ; j <= n ; j ++ )
			if( x[ j ] <= i && y[ j ] >= i + 1 )
				p[ i ] ++ ;

	max_p = p[ min ] ;

	for( i = min + 1 ; i <= max ; i ++ )
		if( max_p < p[ i ] )
			max_p = p[ i ] ;
		
	cout << n << ' ' << max_p ;

	return 0 ;
}
int main()
{
    int RS[1001]={0};
    int n=0,i=0;
    int X[1010],Y[1010];
    while(1)
    {
        cin>>X[i];
        i++;
        if(cin.get()!=',')
        {
            n=i;
            break;
        }
    }
    char comma;
    for(int i=0; i<n-1; i++)
        cin>>Y[i]>>comma;
    cin>>Y[n-1];
    for(i=0; i<n; i++)
        for(int j=X[i]; j<Y[i]; j++)
            RS[j]++;
    for(int j=1; j<1001; j++)
    if(RS[j]>=RS[0])
            RS[0]=RS[j];
    cout<<n<<" "<<RS[0]<<endl;
    return 0;
}
void cin_(int *p)
{
	char cin_temp[10000]={0};//?????????????????
	cin.getline(cin_temp,10000,'\n');//?????????
	int i;
	for(i=0;cin_temp[i]!=0;)//??????????????
	{
		int j;
		for(j=1;cin_temp[i+j]!=','&&cin_temp[i+j]!=0;j++);//???j??
		int temp=0;
		for(int k=1;k<=j;k++)//??j???????int???
		{
			temp=temp+(cin_temp[i+k-1]-'0')*(int)pow(10.0,(double)(j-k));
		}
		*p=temp;//???int????????????
		p++;//int????????????
		i=i+j+1;
	}
}

	


int main()
{
	int in[10000],out[10000];//??????????????????????
	for(int h=0;h<10000;h++)
	{
		in[h]=out[h]=-1;
	}
	cin_(in);//???????
	cin_(out);
	int num;//?num??????
	for(num=0;;num++)
		if(in[num]==-1)
			break;
	int time[1001]={0};//????????????????????
	int i,j;
	for(i=0;i<num;i++)//????????
	{
		for(j=in[i];j<out[i];j++)//j?????????????????????+1
			time[j]++;
	}
	int max=0;
	for(j=0;j<1001;j++)//??time????????????????
	{
		if(time[j]>max)
			max=time[j];
	}
	cout<<num<<" "<<max;
	return 0;
}
//************************************
//??????????
//???:??
//?????2010.11.24
//?????????????????
//************************************
int main ()
{
	//????a,b??????????????????c??????????????i.n.j,i???????
	int a[10000],b[10000], c[100000] = {0}, i, n, j;
	char d;//?????????','?'\n'
	int max = 0;//???????????0
	for ( i = 0; ; i++)
	{
		cin >> a[i];
		d = cin.get();
		if (d =='\n')
			break;
	}//???????????','????????????????
	for ( j = 0; j <= i; j++)
	{	
		cin >> b[j];
		d = cin.get();
	}//??????????','
	for ( n = 0; n <= i;n++)
		for (j = a[n];j < b[n]; j++)
			c[j]++;//??????????????
	for ( j = 0; j < 1000; j++)
	{
		if (c[j] > max)
			max = c[j];
	}//??????
	cout << i + 1 << " " << max << endl;
	return 0;
}