semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/*???1000012904-4.cpp
  ???????????????
  ?????
  ???2010?11?25?
*/
int main()
{
	char come1[10000],leave1[10000];//????????????????
	//?????????????????????????????????????????????????????
	int come2[10000], leave2[10000],num[1001], comma1[10000],comma2[100000], count = 0, max = 0, i ,j, all ;
	memset(come2, 0, sizeof(come2));
	memset(leave2, 0, sizeof(leave2));
	memset(comma1, 0, sizeof(comma1));
	memset(comma2, 0, sizeof(comma2));
	memset(num,0,sizeof(num));//???????
	cin.getline(come1, 10000);
	cin.getline(leave1,10000);//???????????
	for(i = 0; come1[i] != '\0'; i++)
	{
		if(come1[i] == ',')
		{
			comma1[count] = i;
			count++;
		}
	}//???????
	all = count + 1;//???????????1
	for(j = 0; j < comma1[0]; j++)
		come2[0] = come2[0] * 10 + (come1[j] - '0');
	for(i = 1; i < count; i++)
		for(j = comma1[i -1] + 1; j < comma1[i];j++)
			come2[i] = come2[i] * 10 + (come1[j] - '0');
	for(j = comma1[count - 1] + 1; come1[j] != '\0'; j++)
		come2[count] = come2[count] * 10 + (come1[j] - '0');//?????????????????
	count = 0;
	for(i = 0; leave1[i] != '\0'; i++)
	{
		if(leave1[i] == ',')
		{
			comma2[count] = i;
			count++;
		}
	}
	for(j = 0; j < comma2[0]; j++)
		leave2[0] = leave2[0] * 10 + (leave1[j] - '0');
	for(i = 1; i < count; i++)
		for(j = comma2[i -1] + 1; j < comma2[i];j++)
			leave2[i] = leave2[i] * 10 + (leave1[j] - '0');
	for(j = comma2[count - 1] + 1; leave1[j] != '\0'; j++)
		leave2[count] = leave2[count] * 10 + (leave1[j] - '0');//??????????????????
	for(i = 0; i < all; i++)
		for(j = come2[i]; j < leave2[i]; j++)
		num[j] = num[j] + 1;//??????????
	for(i = 0; i < 1001; i++)
	{
		if(max < num[i])
			max = num[i];
	}//????????????????
	cout << all << " " << max << endl;
	return 0;
}
int main()
{
    int a[1000],b[1000];
    int t,i,c,n=0;
    char tc;
    do
    {
    scanf("%d%c",&t,&tc);
    a[n]=t; n++;
}while (tc!=10);

for(i=0;i<n;i++) scanf("%d,",&b[i]);
int max=0,maxp=0;
for(i=0;i<n;i++) if(b[i]>max) max=b[i];


for(t=1;t<max;t++) 
{c=0;
for(i=0;i<n;i++) {if((a[i]<=t)&&(b[i]>t)) c++;}
if (c>maxp) maxp=c;
}

printf("%d %d",n,maxp);

}
main()
{
	int arv[1000],lve[1000],min=0,max=0,num,sum=0,person=0;
	char c;
	int i,j,k;
	for(i=0;;i++)
	{
		scanf("%d",&arv[i]);
		c=getchar();
		if(min>arv[i]) min=arv[i];
		if(c=='\n')
		{
			num=i+1;break;
		}
	}
	scanf("%d",&lve[0]);max=lve[0];
	for(i=1;i<num;i++)
	{
		scanf(",%d",&lve[i]);
		if(lve[i]>max) max=lve[i];
	}
	for(j=min;j<=max-1;j++)//min,max-1~min+1,max
	{
		for(k=0;k<num;k++)
		{
			if(arv[k]<=j&&j+1<=lve[k])
				sum++;
		}
		if(sum>person) person=sum;
		sum=0;
	}
	printf("%d %d\n",num,person);
	return 0;
}
int main()
{
	int x[1001], y[1001], z[1001] = {0}, n, i, j, k;
	char a;
	for(i = 1; i <= 1000; i++)
	{
		cin >> x[i];
		a = cin.get();
		if (a == ',');
		else
		{
			n = i;
			break;
		}
	}
	for (i = 1; i <= 1000; i++)
	{
		cin >> y[i];
		a = cin.get();
		if (a == ',');
		else
			break;
	}
	for (i = 1; i <= n; i++)
	{
		for (j = x[i]; j <= y[i] - 1; j++)
			z[j]++;
	}
	for (i = 1, k = 0; i <= 1000; i++)
	{
		if (z[i] > k)
		{
			k = z[i];
		}
	}
	cout << n << " " << k;
	return 0;
}
/*
 * 123.cpp
 *
 *  Created on: 2010-12-18
 *      Author: 378073652
 */


int main(){
	char a[30000],b[30000];
	int c[10000],d[10000],e[1005],la,lb,i,j,sa=0,sb=0,max=0;
	for(i=0;i<=1004;i++) e[i]=0;
	cin>>a;
	cin>>b;
	la=strlen(a);
	lb=strlen(b);
	c[0]=atof(a);
	for(i=0;i<la;i++){
		if(a[i]==',')
		{sa++;c[sa]=atof(a+i+1);}
	}

	d[0]=atof(b);

	for(i=0;i<lb;i++){
			if(b[i]==',')
			{sb++;d[sb]=atof(b+i+1);}
		}

	for(i=0;i<=sa;i++){
		for(j=c[i];j<d[i];j++){
			e[j]=e[j]+1;
		}
	}
	for(i=0;i<1004;i++){
		if(e[i]>max) max=e[i];
	}





	cout<<sa+1<<" "<<max;
}
//********************************
//*?????? 1300012809      **
//*???2013.10.31             **
//*????????             **
//********************************
int main ()
{ 
    int i,a,b,jishu,x[1001]={0},y[1001]={0},j,renshu=0,ren=0;
	char xijinping;
	for (i=1;i<=2;i++)                      //???2?????????
	{
		if(i==1)                       
		{
		    jishu=0;
			cin >> a;
			xijinping=cin.get();            //????
		    while (xijinping==',')
			{
                x[jishu]=a;
			    jishu=jishu+1;              //????????
				cin >> a ;
				xijinping=cin.get();
			}
			x[jishu]=a;                     //??????????
			jishu=jishu+1;
		}
		if(i==2)
		{
			jishu=0;                        //???????????y??
			cin >> b ;
			xijinping=cin.get();
			while (xijinping==',')
			{	
				y[jishu]=b;
				jishu=jishu+1;
				cin >> b ;
				xijinping=cin.get();
			}
			y[jishu]=b;
			jishu=jishu+1;
		}
	}
    for (j=0;j<=1000;j++)
	{
		if (ren<renshu) ren=renshu;         //???????????????????????????
		renshu=0;
		for(i=0;i<jishu;i++)
		{
			if (x[i]<=j&&j<y[i]) renshu=renshu+1 ;  //????
		}
	}
    cout << jishu << " " << ren << endl;
    return 0;
}
int main()
{
	int num[1000]={0};   //?????????
	int inout[1000][2];   //???????
	int max;
	int n=0;
	int i,j;
	int d;
	char c=',';
	while(c==',')      //??????
	{
	    scanf("%d%c",&d,&c);
	    inout[n][0]=d;
	    n++;
	}
	scanf("%d",&inout[0][1]);
	for(i=1;i<n;i++)             //??????
	{
		scanf(",%d",&inout[i][1]);
	}
	for(i=0;i<n;i++)
	{
		//printf("%d %d\n",inout[i][0],inout[i][1]);//debug
		for(j=inout[i][0];j<inout[i][1];j++)
		{
			num[j]++;
		}
	}
	max=0;
	for(i=0;i<1000;i++)
	{
		if(max<num[i])
			max=num[i];
	}
	printf("%d %d",n,max);
	return 0;
}
//*****************************************************
//*?????????                                 *
//*?  ?????                                     *
//*?  ??1000012806                                 *
//*?????2010.11.26.                              *
//*****************************************************
int main()
{
	int x[1000], y[1000], t[1000] = {0};              //????x[1000],y[1000],t[1000]??????????????????????
	int num = 0, max, i = 0, j;
	char temp = ',';                                  //?temp????               
	char c;                                           //????????c
	do
	{
		cin>>x[i];                                    //????
		i++;                                          
		num ++;                                       //??????
		c=cin.get();
	}while(c!='\n');                                  //?c?????????????????????????
	i = 0;
	do                                                //?????y[i]
	{
		cin>>y[i];
		i++;
		c=cin.get();
	}while(c!='\n');

	for (i = 0; i < 1000; i ++)
	{
		for (j = 0; j < num; j ++)
		{
			if (x[j] <= i && y[j] > i)                //???????????????
				t[i] ++;
		}
	}
	max = t[0];
	for (i = 0; i < 1000; i ++)                       //???????
	{
		if (t[i] > max)
			max = t[i];
	}
	cout<<num<<" "<<max<<endl;                       //????????????
	return 0;
}
int main()
{
	int i,j=0,k=0,n,m=0,a[1001],b[1001],l1,l2,c[1001],p;
	char str1[9999],str2[9999],ch1[1001][100],ch2[1001][100];
	cin.getline(str1,9999,'\n');
	cin.getline(str2,9999,'\n');  //????2????
	l1=strlen(str1);
	l2=strlen(str2);              //????????
	for(i=0;i<=l1-1;i++)
	{
		if(str1[i]!=',')    //??????????
                                       //??????????
		{
			ch1[k][j]=str1[i];
			j++;
		}
		else 
		{
			k++;
			j=0;      //??????????????????
		}
	}
	for(i=0;i<=k;i++)
	{
		a[i]=atof(ch1[i]);  //?????????????
		
	}
	
	k=0;
	j=0;
	for(i=0;i<=l2-1;i++)     //????2??????
	{
		if(str2[i]!=',')
		{
			ch2[k][j]=str2[i];
			j++;
		}
		else 
		{
			k++;
			j=0;
		}
	}
	for(i=0;i<=k;i++)
	{
		b[i]=atof(ch2[i]);
	}
	n=k+1;
    
	for(j=0;j<1000;j++)     //?????????
	{
		c[j]=0;
		for(i=0;i<=k;i++)  //????????
		{
			if(a[i]<=j&&b[i]>j)
                        //?????????????????????1
			{
				c[j]++;
			}
		}
		if(c[j]>m)
		{
			m=c[j];    //??????
		}
	}
	cout<<n<<" "<<m;
		return 0;
}
//*************************************************
//* file: 1000012912_007.cpp                      *
//* author : ???                               *
//* date : 2010.11.24                             *
//* function : ?????                         *
//*************************************************
int main()
{
	int i, j, n, time[1000] = {0}, max,in[1000], out[1000];                 //n????in??????out??????time???????
	char c[1000];
	for ( i = 0; c[i - 1] != '\n'; i ++ )
	{
		cin >> in[i];
		c[i] = cin.get();
	}
	n = i;
	for ( i = 0; c[i - 1] != '\n'; i ++ )
	{
		cin >> out[i];
		c[i] = cin.get();
	}
	for ( i = 0; i < n; i ++ )
		for ( j = in[i]; j < out[i] ; j ++ )
			time[j] ++;                                          //???????1
	max = 0;
	for ( i = 1; i < 1000; i ++ )                                //????????
		if ( time[max] < time[i] )
			max = i;
	cout << n << ' ' << time[max] << endl;
	return 0;
}
int main()
{
	int x[1020]={0},y[1020]={0},n=0,i,j,k=0,t=0,p=0,max=0;
	char c[3000];
	gets(c);
	for(i=0;c[i]!=0;i++)
	{
		if(c[i]!=',') x[n]=x[n]*10+c[i]-'0';
		else n++;
	}
	n++;
	for(i=0;i<n-1;i++) scanf("%d,",&y[i]);
	scanf("%d",&y[n-1]);
	for(i=0;i<n-1;i++)
	{
		for(j=0;j<n-1-i;j++)
		{
			if(x[j]>x[j+1])
			{
				x[j]=x[j]+x[j+1];
				x[j+1]=x[j]-x[j+1];
				x[j]=x[j]-x[j+1];
			}
			if(y[j]>y[j+1])
			{
				y[j]=y[j]+y[j+1];
				y[j+1]=y[j]-y[j+1];
				y[j]=y[j]-y[j+1];
			}
		}
	}
	j=0;
	for(t=0;t<=y[n-1];t++)
	{
		for(i=j;;i++)
		{
			if(t==x[i])
			{
				p++;
				j++;
			}
			if(t<x[i]) break;
		}
		for(i=k;;i++)
		{
			if(t==y[i])
			{
				p--;
				k++;
			}
			if(t<y[i]) break;
		}
		if(p>max) max=p;
	}
	printf("%d %d\n",n,max);
	return 0;
}
int main()
{
	char c;
	int x[1001], y[1001], sum[1001] = {0};
	int i, j, n, h, m, k, max = 0;
	for(i = 0; ; i++)
	{
		cin >> x[i];
		c = getchar();
		if(c == '\n')
			break;
	}
	for(j = 0; j <= i; j++)
	{
		cin >> y[j];
		c = getchar();
	}
	for(k = 0; k < 1000; k++)
	{
		for(m = 0; m <= i; m++)
		{
			if(x[m] <= k && y[m] > k)
			{
				sum[k]++;
			}
		}
	}
	for(h = 0; h < 1000; h++)
	{
		if(sum[h] > max)
			max = sum[h];
	}
	cout << i + 1<<" " << max << endl;
	return 0;
}
int main() {
        int start[1000];
        int end[1000];

        int time[1024];
        int n = 0;
        for(int i = 0;;i++) {
                n ++;
                cin >> start[i] ;
                char c = cin.get();
                if (c!=',')
                        break;
        }
        for(int i = 0; ; i ++) {
                cin >> end[i];
                char c = cin.get();
                if(c!=',')
                        break;
        }

        for (int i = 0; i < 1024; i ++)
                time[i] = 0;
        for (int i = 0; i < n; i ++) {
                for (int j = start[i]; j < end[i]; j ++)
                        time[j] ++;
        }
        int max = 0;
        for (int i = 0; i < 1024; i ++) {
                if (max < time[i])
                        max = time[i];
        }
        cout << n << " " << max << endl;
        return 0;
}
/*
2010 12 22 ??
?????
????
????2???2????????? 
?1????i???????xi?????????? 
?1????i??????????yi??????????? 
??? 
2,5,4,6,7,3,1,6,2 
5,6,7,7,8,4,3,9,4 

???9????????????? 
[2,5),[5,6),[4,7),[6,7),[7,8),[3,4),[1,3),[6,9),[2,4)
?? 1000012760
*/


int main(){
	int T[1000]= {0}, x[1000]= {0}, y[1000]= {0}, i= 0, n= 0, k= 0, MostPeople= 0, People= 0;;
	char test;
	while(1){
		cin>>x[i];
		test= getchar();
		People++;
		i++;
		if(test== '\n')
			break;
	}
	i= 0;
	while(1){
		cin>>y[i];
		test= getchar();
		i++;
		if(test== '\n')
			break;
	}

	for(i= 0; i< People; i++){
		k= 0;
		while(k< (y[i]- x[i])){
			T[x[i]+ k]++;
			k++;
		}
	}

	for(i= 0; i< 1000; i++){
		if(T[i]> MostPeople)
				MostPeople= T[i];
	}

	cout<<People<<' '<<MostPeople<<endl;
	
	return 0;
}
int x[2000],y[2000];
int main()
{
	int n=0;
	char lt;
	while(++n){
		cin>>x[n];
		cin.get(lt);
		if(lt!=',')break;
	}
	for(int i=1;i<=n;i++){
		cin>>y[i];
		cin.get(lt);
	}
	int max=0;
	for(int i=0;i<1000;i++){
		int cnt=0;
		for(int j=1;j<=n;j++){
			if(x[j]<=i&&i<y[j])cnt++;
		}
		max=max>cnt?max:cnt;
	}
	cout<<n<<' '<<max;
	return 0;
}
int main()
{	char firstline[10000],secondline[10000],temp[100];//??????????????????????????????????????
	int enter[3000],exit[3000],k=0,i,g=0,j,num,min=1000,max=0,point[1000]={0},result=0;//????
	cin.getline(firstline,10000);//?????????
	cin.getline(secondline,10000);//?????????
	for(i=0;i<=strlen(firstline);i++)
	{
		if(firstline[i]!=','&&firstline[i]!='\0')//???????????
		{
		temp[k]=firstline[i];//????????????temp???
		k++;
		}
		else
		{
		enter[g]=atoi(temp);//?????temp???????????????enter???
		memset(temp,0,sizeof(temp));//?temp??????
		g++;//???
		k=0;//??
		}
	}
	num=g;//g?????????
	g=0;//???0?????????
	for(i=0;i<=strlen(secondline);i++)//????
	{
		if(secondline[i]!=','&&secondline[i]!='\0')
		{
		temp[k]=secondline[i];
		k++;
		}
		else
		{
		exit[g]=atoi(temp);
		memset(temp,0,sizeof(temp));
		g++;
		k=0;
		}
	}
	for(i=0;i<num;i++)//??????????
	{
		if(enter[i]<min) min=enter[i];
	}
	for(i=0;i<num;i++)//??????????
	{
		if(exit[i]>max) max=exit[i];
	}
	for(i=min;i<max;i++)//????????????????
	{
		for(j=0;j<num;j++)//????????
		{
			if(enter[j]<=i&&exit[j]>i) point[i]++;//????????????????????1
		}
	}

	
	for(i=min;i<max;i++)
	{
		if(point[i]>=result) result=point[i];//?point???????
	}
	cout<<num<<" "<<result;//??
	return 0;
}
int main()
{
	int in[1000],out[1000],result=0,num=1,i,j,k,t[1000]={0};
	char x='0';
    for (i=0;;i++)
    {  
		cin >> in[i];
		x=cin.get();
		if (x=='\n')
		{
			break;
		}
		num=num+1;
	}
	x='0';
    for (i=0;;i++)
	{
	    cin >> out[i];
		x=cin.get();
		if (x=='\n')
		{
			break;
		}
	}
	for (j=0;j<=num-1;j++)
	{
		for (k=in[j];k<out[j];k++)
		{
			t[k]++;
		}
	}
	result=0;
	for (i=0;i<1000;i++)
	{
		if (t[i]>result)
		{
			result=t[i];
		}
	}
	cout << num << " " << result << endl;
	return 0;
}
int main()
{
	int time[1001] = {0}, tin[1001], tout[1001];
	char a = ',';
	int p_num = 1;
	cin >> tin[1];
	while ((a = getchar()) != '\n')
	{
		p_num++;
		cin >> tin[p_num];
	}
	p_num = 1;
	cin >> tout[1];
	while ((a = getchar()) != '\n')
	{
		p_num++;
		cin >> tout[p_num];
	}
	for (int p = 1; p <= p_num; p++)
		for (int i = tin[p]; i < tout[p]; i++)
			time[i]++;
	int p_max = 0;
	for (int i = 0; i <= 1000; i++)
		if (p_max < time[i])
			p_max = time[i];
	cout << p_num << ' ' << p_max;

	return 0;
}
/*****************
*file:5.cpp
*author:?? 
*time:2013-10-30
*description:?????????? 
*******************/
int main()
{
	int n = 0, i = 1, j = 1, max = -1000, x;
	int a[1000], b[1000], c[1000]={0}; //?? c???????????? 
	cin >> a[0];
	while (scanf(",%d",&x)>0)
	{
		a[i] = x;
        n++;
		i++;
	}//????a 
	cin >> b[0];
	while (scanf(",%d",&x)>0)
	{
		b[j] = x;
		j++;
	}//????b 
	for (int k = 0; k < i; k++)
	{
		for (int p = a[k]; p < b[k]; p++)
		{
			c[p]++;
		}
	}//??????????????? 
	for (int k = 1; k < 1000; k++)
	{
		if (max < c[k])
			max = c[k];
	}//??????????? 
	if (n == 0)//??????????????????1 
	{
		cout << "1 1";
	}
	else //????1??? 
	{
		cout << n + 1 << ' ' << max;
	}
	return 0;
}
int in[20000]={0},out[20000]={0};
char line1[20000], line2[20000];
int t=1,s=1;


struct time
{
    int in;
    int out;
}person[10000];

int convert();

int main()
{
	
	int	 max = 0;
	
	cin.getline(line1,20000);
	cin.getline(line2,20000);
	convert();

	for(int i=0; i<1000; i++)
	{
		int counter=0;
		for(int j=0; j<t; j++)
		{
			if(person[j].in<=i && person[j].out>i)
			{
				counter++;
				if(counter>max)
					max=counter;
			}
		
		
		}

	
	}

	cout<<t<<" " <<max;
return 0;
}

int convert()
{
	
	person[0].in=atof(line1);
	for(int i=0; i<strlen(line1);i++)
	{
		
		if(line1[i-1]!=',')
			continue;
		else
		{
			person[t].in=atof(&line1[i]);
			t++;
		}
	}
	
	person[0].out=atof(line2);
	for(int i=0; i<strlen(line2);i++)
	{
		
		if(line2[i-1]!=',')
			continue;
		else
		{
			person[s].out=atof(&line2[i]);
			s++;
		}
	}

return 0;
}
int main()
{ int i,j,a[1000]={0},b[1000]={0},n=0,n1=0,mid;
int min1=1000,max1=0,min2=1000,max2=0,d[1000]={0};
int t =0,max=0;
char c;
for(;;)
	{
		scanf("%d", &a[n1++]);
		scanf("%c", &c);
		if(c != ',')
			break;
	}

//n1??
for(;;)
	{
		scanf("%d", &b[n++]);
		scanf("%c", &c);
		if(c != ',')
			break;
	}

for(i=0;i<n1;i++)
		{  	if(a[i]>max1)
				max1=a[i];
if(b[i]>max2)
				max2=b[i];
					if(a[i]<min1)
				min1=a[i];
if(b[i]<min2)
				min2=b[i];
					
}	
for(i=min1;i<=max2;i++)				
{for(j=0;j<n1;j++)
{if(a[j]<=i&&b[j]>i)
d[t]++;
}
t++;
}

for(i=0;i<t;i++)
{	if(d[i]>max)
				max=d[i];
}
printf("%d %d",n1,max);
			
		
		


return 0;

}
int main()
{
	int i = 0, n, m = 0, x[1000], y[1000], j, s[1000] = {0};
	char c;
    for(;;i++)
	{
		cin >> x[i] ;
		cin.get (c);
		if(c != ',') break;
	}
	n = i + 1;
	for(j = 0 ; j < n ; j ++)
	{
		cin >> y[j];
		cin.get (c);
	}
	for(i = 0 ; i < n ; i ++)
	{
		for(j = x[i]; j < y[i] ; j ++)
		{
			s[j] ++;
		}
	}
	for(i = 0 ; i < 1000 ; i ++)
	{
		if(s[i] > m)
		{
			m = s[i];
		}
	}
	cout << n << " " << m;
	return 0;
}
main()
{
	int i=0,j,k,reach[10000],leave[10000],num=0,max=0;char a;
	do
	{
		scanf("%d%c",&reach[i],&a);
		i++;
	}
	while(a!='\n');
	printf("%d ",i);
	for(j=0;j<i;j++)
		scanf("%d%c",&leave[j],&a);
	for(j=0;j<1000;j++)
	{
		for(k=0;k<=i;k++)
			if(reach[k]<=j&&leave[k]>j)num++;
		if(num>max)max=num;
		num=0;
	}
	printf("%d",max);
}
int main()
{
	int i,j,k,s=0,max=0,t=0;
	int a[1020],b[1020],d[1000]={0};
	char c;
	for(i=1;;i++)
	{
		cin>>a[i];
		c=cin.get();
		if(c!=',') break;
	}
	for(j=1;j<=i;j++)
	{
		cin>>b[j];
		cin.get();
		if(b[j]>t) t=b[j];
	}
	for(j=1;j<=i;j++)
	{
		for(k=a[j];k<b[j];d[k]++,k++);
	}
	for(j=0;j<=t;j++)
	{
		if(d[j]>max) max=d[j];
	}
	cout<<i<<" "<<max<<endl;
	return 0;
}
int main()
{
	int time[1000] = {0}, intime[1000] = {0}, outtime[1000] = {0},
		i = 0, j = 0, peoplesum = 0, maxsum = 0;
	char mark;
	do{
		cin >> intime[i];
		mark = cin.get();
		peoplesum++;
		i++;
	}while(mark != '\n');
	i = 0;
	do{
		cin >> outtime[i];
		mark = cin.get();
		i++;
	}while(mark != '\n');
	for (i = 0; i < peoplesum; i++)
		for (j = intime[i]; j < outtime[i]; j++)
			time[j]++;
	for (j = 0; j < 1000; j++)
		if (time[j] > maxsum)
			maxsum = time[j];
	cout << peoplesum << " " << maxsum;
	return 0;
}
void main()
{
	int a[10000],i,j,b[10000],s,t,n[10000],max=0;
	char c[10000],d[10000];
	for(i=0; ;i++)
	{
		scanf("%d%c",&a[i],&c[i]);s=i+1;
		if(c[i]!=',')
			break;
	}
	for(i=0; ;i++)
	{
		scanf("%d%c",&b[i],&d[i]);t=i+1;		if(d[i]!=',')
			break;
	}
	for(i=0;i<1000;i++)
	{
		n[i]=0;
		for(j=0;j<s;j++)
		{
			if(a[j]<=i&&b[j]>=i+1)
				n[i]=n[i]+1;
		}
	}
	for(i=0;i<1000;i++)
	{
	   if(max<n[i])
		 max=n[i];
	}
	printf("%d %d",s,max);
}
int main()
{
    int a[1000], b[1000], c[1001], n, i = 0, j, max = 0;
    char ch;
    for(j = 0; j < 1001; j++)
        c[j] = 0;
    while(1)
    {
        cin >> a[i];
        cin.get(ch);
        i++;
        if(ch == '\n')
            break;
    }
    n = i;
    for(i = 0; i < n-1; i++)
        cin >> b[i] >> ch;
        cin >> b[n-1];
    for(i = 0; i < n; i++)
    {
        for(j = a[i]; j < b[i]; j++)
           {
            c[j] = c[j] + 1;
           }
    }
    for(j = 0; j < 1001; j++)
    {
        if(c[j] > max)
            max = c[j];
    }
    cout << n << " " << max << endl;
    return 0;
}
int main()
{
	char x[4000],y[4000];
	int xi[1000] = {0},yi[1000] = {0};
	int jl[1000] = {0};
	int i,j,l,js,s = 0,n = 1,max = 0;
	cin >> x >> y;
	l = strlen(x);js = 1;
	for (i = l-1;i >= 0; i--)
	{
		if (x[i] == ',')
		{
			n ++;
			js = 1;
		}
		else
		{
			xi[n] = xi[n] + (x[i] - '0') * js;
			js *= 10;
		}
	}
	cout << n << ' ';
	n = 1;
	l = strlen(y);js = 1;
	for (i = l-1;i >= 0; i--)
	{
		if (y[i] == ',')
		{
			n ++;
			js = 1;
		}
		else
		{
			yi[n] = yi[n] + (y[i] - '0') * js;
			js *= 10;
		}
	}
	for (i = 1;i <= n; i++)
		for (j = xi[i]; j < yi[i] ;j++)
		{
			jl[j] ++;
			if (jl[j] > max) 
				max = jl[j];
		}
	cout << max;
	cin >> i;
	return 0;
}
/*
 * ???: 1000010191_39_8.cpp
 * ??: ???
 * ????: 2011-1-1
 * ??: ?????
 */


int main()
{
	int n=0;
	char ch;
	int s[2000],e[2000];
	int d[1001]={0};
	//??
	do
	{
		n++;
		cin>>s[n];
		ch=cin.get();
	} while (ch==',');
	for (int i=1;i<=n;i++)
	{
		cin>>e[i];
		cin.get();
	}
	//??
	for (int i=1;i<=n;i++)
		for (int j=s[i];j<e[i];j++) d[j]++;
	cout<<n<<' ';
	int max=0;
	for (int i=0;i<1000;i++)
		if (d[i]>max) max=d[i];
	cout<<max<<endl;
	return 0;
}
void count(int n, int x[], int y[], int a[]);
int findmax(int a[]);
int main()
{
	int x[1000],y[1000],a[1001] = {0}, n = 0;
	int i;
	for(i = 0; ; i++)
	{
		cin >> x[i];
		n++;
		if(cin.get() != ',')
			break;
	}
	
	for(i = 0; i < n; i++)
	{
		cin >> y[i];
		cin.get();
	}

	count(n, x, y, a);
	cout << n << " " << findmax(a);
	return 0;
}

void count(int n, int x[], int y[], int a[])
{
	int i, j;
	for(i = 0; i < n; i++)
	{
		for(j = x[i]; j < y[i]; j++)
			a[j]++;
	}
}

int findmax(int a[])
{
	int i;
	int	max = 0;
	for(i = 1; i <= 1000; i++ )
	{
		if(max < a[i])
			max = a[i];
	}

	return max;


}
int main()
{
	char x[5000],y[5000];               //????????????????
	char str_x[5000][4],str_y[5000][4]; 
	int time_x[5000],time_y[5000];
	int num[5000]={0}; 
	
	int k=0,i=0,j=0;
	int m,sum=1,max=0;

	cin.getline(x,5000);              //???????????
	cin.getline(y,5000);

	for(m=0;m<strlen(x);m++)          //????
	    if(x[m]==',')
			sum+=1;	
	cout<<sum<<" ";
		
	for(k=0;k<strlen(x);k++)          //?????????????????????
	{
		if(x[k]!=',')
		{
			str_x[i][j]=x[k];
			j++;
		}
		else
		{
			i++;
			j=0;
		}
	}
	i=0;
	j=0;

	for(k=0;k<strlen(y);k++)
	{
		if(y[k]!=',')
		{
			str_y[i][j]=y[k];
			j++;
		}
		else
		{
			i++;
			j=0;
		}
	}

	for(i=0;i<sum;i++)                  //?????????????
	{
		time_x[i]=atof(str_x[i]);
		time_y[i]=atof(str_y[i]);
	}

	for(i=0;i<sum;i++)                  //????????????
	{
		while(time_x[i]<time_y[i])
		{
			num[time_x[i]]++;
			time_x[i]++;
			
		}
	}

	for(j=0;j<5000;j++)                 //???????????
		if(num[j]>max)
			max=num[j];
	cout<<max;

	return 0;
}
int input(char s[],int a[])
{
	int len=strlen(s);
	int i,j=0;
	a[j]=s[0]-'0';
	for(i=1;i<len;i++)
		if(s[i]>='0'&&s[i]<='9')
		{
			if(s[i-1]>='0'&&s[i-1]<='9')
				a[j]=a[j]*10+s[i]-'0';
			else 
			{	
				j++;
				a[j]=s[i]-'0';
			}
		}		
	return(j+1);
}
void main()
{
	char a[5050],b[5050];
	int x[1010],y[1010],n,i,count[1010]={0};
	gets(a);
	gets(b);
	n=input(a,x);
	n=input(b,y);
	int p;
	for(p=0;p<1000;p++)
		for(i=0;i<n;i++)
			if(p>=x[i]&&p<y[i])
				count[p]++;
	int max=0;
	for(p=0;p<1000;p++)
		if(count[p]>max)max=count[p];
	printf("%d %d",n,max);
}
int main()
{
	int count[100000]={0},a[100000],i,j,p=0,max=0,len1,len2,m=0,n=0;
	char str1[100000],str2[100000],strx[100000],stry[100000];
	cin.getline(str1,100000);
	cin.getline(str2,100000);
	len1=strlen(str1);
	len2=strlen(str2);
	for(i=0;i<len1;i++)
	{
		while(str1[i]>='0'&&str1[i]<='9'&&i<len1)
		{
				strx[m]=str1[i];
				i++;m++;
		}
		strx[m]='\0';
		a[p]=atoi(strx);p++;
		memset(strx,0,100000);
		m=0;
	}
	for(i=0;i<len2;i++)
	{
		while(str2[i]>='0'&&str2[i]<='9'&&i<len2)
		{
				stry[n]=str2[i];
				i++;n++;
		}
		stry[n]='\0';
		a[p]=atoi(stry);p++;
		memset(stry,0,100000);
		n=0;
	}
	for(i=0;i<1000;i++)
	{
		for(j=0;j<p/2;j++)
		{
				if(a[j]<=i&&i<a[j+p/2])
				count[i]++;
		}
	}
	for(i=0;i<1000;i++)
	{
		if(count[i]>max)
			max=count[i];
	}
	cout<<p/2<<" "<<max;
	return 0;
}
void main()
{
	int a[2000],b[2000],max,min,i=0,j,n,k=0,s=0;
	char x=',';
	while(x!='\n')
	{
		scanf("%d",&a[i]);
        x=getchar();
		i++;
	}
	n=i;
	for(i=0;i<n;i++)
		scanf("%d%c",&b[i],&x);
	min=a[0];max=b[0];
	for(i=0;i<n;i++)
	{
		if(a[i]<min)min=a[i];
		if(b[i]>max)max=b[i];
	}
for(i=min;i<=max;i++)
	{
		for(j=0;j<n;j++)
			if(i>=a[j]&&i<b[j])k++;
			if(k>s)s=k;
			k=0;
	}	
	printf("%d %d",n,s);
}