semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int x[1001],y[1001],i,j,m,k=0,a[1001],b[1001]={0};
	char c;
	for(i=1;i<1001;i++)
		a[i]=i;
	for(i=1;i<1001;i++)
	{
		scanf("%d%c",&x[i],&c);
			k+=1;
		if(c!=',')
			break;
	}
	for(i=1;i<=k;i++)
		scanf("%d%c",&y[i],&c);
	for(i=1;i<=k;i++)
		for(j=x[i];j<y[i];j++)
			b[j]+=1;
	m=b[1];
	for(i=2;i<1001;i++)
	{
		if(b[i]>m)
			m=b[i];
	}
	printf("%d %d\n",k,m);
	return 0;
}
int main ()
{int x[1000];
  int y[1000];
  int i,n,s,t,j;
  char c;
for(i=0;;i++)
  { scanf("%d%c",&x[i],&c);
    if(c!=',') break;
  } 
 n=i+1;
for(i=0;;i++)
  { scanf("%d%c",&y[i],&c);
    if(c!=',') break;
  } 
  t=0;
 for(i=0;i<1000;i++)
 {   s=0;
	 for(j=0;j<n;j++)
	{   if( i>=x[j]&&i<y[j])
	    s++;
	 }
	 if(s>t) t=s;
 }
 printf("%d %d",n,t);

return 0;
}
//***************************
//*????????        **
//*????? 1300012921   **
//*???2013.10.30        **
//*************************** 
int main()

{
	int x[1001], y[1001], time[1001] = {0};
	int i = 0;
	char ch;
	
	do
	{
		i++;
		cin >> x[i];
		ch = cin.get();
	}while (ch == ',');
	
	i = 0;
	
	do
	{
		i++;
		cin >> y[i];
		ch = cin.get();
	}while (ch == ',');
	
	for(int j = 1; j <= i; j++)
	{
		for(int k = x[j]; k < y[j]; k++)
			time[k] = time[k] + 1;
	}
	
	int max = 0;
	for(int l = 1; l <= 1000; l++)
	{
		if(time[l] > max)
			max = time[l];
	}
	
	cout << i << " " << max << endl;
	return 0;
}
//---------------
//   ?????
//   2010/12/22
//     ADE
//---------------


int get(int arr[1000])//?????????????
{
	int t=0,i=0;
	char c;
	cin>>arr[i];
         i++;
	while((c=cin.get())!='\n')
	{
		cin>>arr[i];
		i++;
	}
	return i;//?????
}
int main()
{
	int i,k,s[1000],e[1000],time[1000],num,max=0,endtime=0;//max???????endtime??????
	for(i=0;i<1000;i++)
		s[i]=e[i]=time[i]=0;
	num=get(s);
	num=get(e);
	for(i=0;i<num;i++)
	{
		if(endtime<e[i])endtime=e[i];  //??????
		for(k=s[i];k<e[i];k++)  //?i?????????????+1
			time[k]++;
	}
	for(i=0;i<endtime;i++)
		if(max<time[i])
			max=time[i];
	cout<<num<<" "<<max;
	return 0;
}
int sum=0,len=0,maxn=0;
char times[10001]={0};
char inch[1001][5],outch[1001][5];
int in[2001],out[1001],sch[1001]={0};
int main()
{
    int i,j=0,k=0;
    memset(times,0,sizeof(times));
    cin>>times;
    while(times[len]) len+=1;
    for(i=0;i<len;++i)
    {
            if(isdigit(times[i]))
            {
                    inch[j][k]=times[i];
                    k++;
            }
            else
            {
                    j++;
                    k=0;
            }
    }
    len=0;
    j=0;
    k=0;
    memset(times,0,sizeof(times));
    cin>>times;
    while(times[len]) len++;
    for(i=0;i<len;++i)
    {
            if(isdigit(times[i]))
            {
                    outch[j][k]=times[i];
                    k++;
            }
            else
            {
                    j++;
                    k=0;
            }
    }
    sum=j+1;
    for(i=0;i<sum;++i)
    {
            in[i]=atoi(inch[i]);
            out[i]=atoi(outch[i]);
    }
    for(i=0;i<sum;++i)
    {
            for(j=in[i];j<out[i];++j)
            {
                    sch[j]++;
            }
    }
    for(i=0;i<1001;++i) if(sch[i]>maxn) maxn=sch[i];
    cout<<sum<<" "<<maxn<<endl;
    return 0;
}
int main()
{
	int in[1002],out[1002],time[1002]={0};
	int temp,i,j,k,num;
	char space;
	for(i=0;;i++)
	{
		scanf("%d%c",&temp,&space);
		in[i]=temp;
		if(space!=',') break;
	}
	num=i+1;
	for(i=0;;i++)
	{
		scanf("%d%c",&temp,&space);
		out[i]=temp;
		if(space!=',') break;
	}
	for(i=0;i<num;i++){
		for(j=in[i];j<out[i];j++){
			time[j]++;
		}
	}
	int max=0;
	for(i=0;i<=1001;i++){
		if(time[i]>max)
			max=time[i];
	}
	printf("%d %d",num,max);		  
}
int main()
{
	int i;
	int a[1001], b[1001];
	for( i = 1; ; i++)
	{
		cin >> a[i];
		char ch = cin.get();
		if( ch != ',' )
			break;
	}
	for( i = 1; ; i++)
	{
		cin >> b[i];
		char ch = cin.get();
		if( ch != ',' )
			break;
	}
	int t = i;
	cout << t << " ";
	int c[1001] = {0}, max = 0;
	for(int i = 0; i < 1000; i++)
	{
		for(int j = 1; j <= t; j++)
		{
			if( i >= a[j] && i < b[j] )
				c[i] ++;
		}
		if( c[i] > max )
			max = c[i];
	}
	cout << max << endl;
	return 0;
}
/*
 * 1.cpp
 *
 *  Created on: 2011-12-19
 *      Author: 1100012870
 */
int main()
{
	int x[1001]={0},y[1001]={0},a[1001]={0},i,ans,l=1;
	char p;
	p=getchar();
	while(p!='\n'){
		if(p==','){
			p=getchar();
			l++;
		}
		x[l]=x[l]*10+p-'0';
		p=getchar();
	}
	cout<<l<<' ';
	l=1;
	p=getchar();
	while(p!='\n'){
		if(p==','){
			p=getchar();
			l++;
		}
		y[l]=y[l]*10+p-'0';
		p=getchar();
	}
	for(i=1;i<=l;i++){
		for(int j=x[i];j<y[i];j++)
			a[j]++;
	}
	ans=0;
	for(i=0;i<=1000;i++)
		if(ans<a[i])ans=a[i];
	cout<<ans;
	return 0;
}
void main()
{
	int i,j,n=1,a[1000],b[1000],c[1000]={0},t1,t2;

	scanf("%d",&a[0]);
	while(scanf(",%d",&a[n]))
		n++;
	scanf("%d",&b[0]);
	for(i=1;i<n;i++)	
		scanf(",%d",&b[i]);

	t1=a[0];
	t2=b[0];
	for(i=0;i<n;i++)
	{
		if(t1>a[i])
			t1=a[i];
		if(t2<b[i])
			t2=b[i];
	}

	for(i=t1;i<=t2;i++)
		for(j=0;j<n;j++)
			if(i>=a[j]&&i<b[j])
				c[i-t1]++;

	j=c[0];
	for(i=1;i<=t2-t1;i++)
		if(j<c[i])
			j=c[i];

	printf("%d %d\n",n,j);
}
int main()
{
    int x[1000]={0},y[1000]={0},counter=0,len,i,j,max=0,temp=0;;
    char s[10000];
    gets(s);
    len=strlen(s);
    for(i=0;i<len;i++)
    {
                      if(s[i]==',')
                      counter++;
                      else
                      {
                          x[counter]=x[counter]*10;
                          x[counter]=x[counter]+s[i]-'0';
                      }
    }
    gets(s);
    len=strlen(s);
    counter=0;
    for(i=0;i<len;i++)
    {
                      if(s[i]==',')
                      counter++;
                      else
                      {
                          y[counter]=y[counter]*10;
                          y[counter]=y[counter]+s[i]-'0';
                      }
    }
    counter++;//?????
    for(i=0;i<1000;i++)
    {
                       temp=0;
                       for(j=0;j<counter;j++)
                       {
                                               if(x[j]<=i&&y[j]>i)
                                               temp++;
                       }
                       if(temp>max)
                       max=temp;
    }
    printf("%d %d",counter,max); 
    return 0;
}
//********************
//***
//**??? 1300012728* 
//**2013.10.30********
//********************
int main()
{
	int time[1000];                      // ???????
	for (int i = 0; i < 1000; i++)
	time[i] = 0;
	int begin[1001], end[1001];               // ?????????????? 
	int n = 1;                                // ?????n 
	char point;                               // ??point??? 
	while (cin >> begin[n])                   // ????begin?? 
	{
		cin.get(point);
		if (point != ',')                     // ??????????????? 
			break;
		n++;                                  // ???+1 
	}
	for (int i = 1; i <= n; i++)
	{
			cin >> end[i];
			cin.get();
	}
	
	for (int i = 1; i <= n; i++)
	{
		 for (int j = begin[i]; j < end[i]; j++)
		 	time[j] += 1;
	}
	int max = 0;
	for (int i = 1; i < 1000; i++)
	{
		if(max <= time[i])
		{
			max = time[i];
		}
	}
	cout << n <<" "<< max;
	return 0;
}
//********************************
//*????????   **
//*?????? 1300012934 **
//*???2013.10.31  **
//********************************


int main()
{  
	int x[1000], y[1000], t[1000] = {0}, n, number, tmax; //t????????
	char douhao;

	n = 1; //n??????????????????
	cin >> x[0];
	while ((douhao = cin.get()) != '\n')
	{
		cin >> x[n];
		n++;
	}
	cin >> y[0];
	for (int i=1; i <= n - 1; i++) //??y?y?x???????
	{
		cin >> douhao >> y[i];
	}
	for (int i=0; i <= n - 1; i++)
	{
		for (int j=x[i]; j < y[i]; j++) //?????????????
		{
			t[j]++;
		}
	}
	number = 0; //number????????????
	tmax = 0; //tmax?????????????????????????
	for (int i=0; i <= n - 1; i++)
	{
		if (tmax < y[i])
			tmax = y[i]; //?????????????????
	}
	for (int i=0; i <= tmax - 1; i++)
	{
		if (number < t[i])
			number = t[i];
	}
	cout << n << " " << number;


	return 0;

}
//********************************
//*???????? **
//*?????? 1300062706 **
//*???2013.10.31**
//********************************
int main()
{
	int i = 0, j = 0, m, k, x, y, temp, a[1000], b[1000], c[1000] = {0};
	char ch;
	while (cin >> x)
	{
		ch = cin.get();
		while (ch == ',')
		{
			a[i] = x;
			i++;
			cin >> x;
			ch = cin.get();
		}
		if (ch == '\n')
		{
			a[i] = x;
			break;
		}
	}
    while (cin >> y)
	{
		ch = cin.get();
        while (ch == ',')
		{
			b[j] = y;
			j++;
			cin >> y;
			ch = cin.get();
		}
		if (ch == '\n')
		{
			b[j] = y;
			break;
		}
	}
    for (m=0;m<=j;m++)
	{
		for (k=a[m];k<b[m];k++)
		{
			c[k]++;
		}
	}
    for (i=1;i<=999;i++)
	{
		if (c[0] < c [i])
			c[0] = c[i];
	}
	cout << j+1 << " " << c[0] << endl;
	return 0;
}
int main() {
	int i, j, a = 0, lenth, max = 0;
	char come1[20000], leave1[20000];
	cin.getline(come1, 20000);
	cin.getline(leave1, 20000);
	lenth = strlen(come1);
	for (i = 0; i < lenth; i++)
		if (come1[i] == ',')
			a++;
	a++;
	cout << a << " ";
	int come[a], leave[a];
	int at[1000];
	come[0] = atoi(come1);
	a = 1;
	for (i = 0; i < lenth; i++) {
		if (come1[i] == ',') {
			come[a] = atoi(come1 + i + 1);
			a++;
		}
	}
	lenth = strlen(leave1);
	leave[0] = atoi(leave1);
	a = 1;
	for (i = 0; i < lenth; i++) {
		if (leave1[i] == ',') {
			leave[a] = atoi(leave1 + i + 1);
			a++;
		}
	}
	for (i = 0; i < 1000; i++)
		at[i] = 0;
	for (i = 0; i < a; i++) {
		for (j = come[i]; j < leave[i]; j++) {
			at[j]++;
		}
	}
	max = at[0];
	for (i = 1; i < 1000; i++) {
		if (at[i] > max) {
			max = at[i];
		}
	}
	cout << max << endl;
	return 0;
}
void main()
{
	int x[1000]={0},y[1000]={0};
	char c;
	int i=1,k,j=0,t,max=0;
	while((c=getchar())!='\n')
	{
		if(c!=',')
		{
			x[i]=x[i]*10+c-'0';
		}
		else i++;
	}
	k=i;i=1;
	//for(i=1;i<=k;i++) printf("%d ",x[i]);
	while((c=getchar())!='\n')
	{
		if(c!=',')
		{
			y[i]=y[i]*10+c-'0';
		}
		else i++;
	}
	printf("%d ",k);
	for(t=0;t<=1000;t++)
	{
		j=0;
		for(i=1;i<=k;i++)
		{
			if(t>=x[i]&&t<y[i])
				j++;
		}
		if(max<j) max=j;
	}
	printf("%d\n",max);
}
int main()
{
	int a[1001], b[1001], num = 1, i, j, temp = 0, max = 0;
	char c;
	do 
	{
		cin >> a[num];
		cin.get(c);
		num++;
	}while (c == ',');
	num = 1;
	do 
	{
		cin >> b[num];
		cin.get(c);
		num++;
	}while (c == ',');
	cout << num - 1;
	num--;
	for (i = 0; i < 1000; i++)
	{
		for (j = 1; j <= num; j++)
		{
			if (i >= a[j] && i < b[j])
				temp++;
		}
		if (max < temp)
			max = temp;
		temp = 0;
	}
	cout << ' ' << max << endl;
	return 0;
}
int main()
{
	int i,j,n,num[1000]={0},sum=0,g[1001][2];        //?????????
	char s[1001][2];
	for(i=1;i<1001;i++)                              //?????????????
	{
		n=i;
		cin>>g[i][0];
		cin.get(s[i][0]);
		if(s[i][0]=='\n')
			break;
	}
	for(i=1;i<=n;i++)                                //??????
	{
		cin>>g[i][1];
		cin.get(s[i][1]);
		if(s[i][1]=='\n')
			break;
	}
	cout<<n<<" ";                                    //??????
	for(i=0;i<1000;i++)                              //???????????
		for(j=1;j<=n;j++)
		{
			if(g[j][0]<=i&&g[j][1]>i)
				num[i]=num[i]+1;
		}
	for(i=0;i<1000;i++)                              //????????
	{
		if(sum<=num[i])
			sum=num[i];
	}
	cout<<sum;
	
	return 0;
}
int p(int n)
{
    int sum=1;
    for(int i=0;i<n;i++)  sum=sum*10;
    return sum;
}
void change(int time[1001],char str[1001])
{
    int j=0,k=0;
    for(int i=strlen(str)-1;i>=0;i--)
    {
            if(str[i]!=',')
            {
                           time[k]=time[k]+(str[i]-'0')*p(j);
                           j++;
            }
            else
            {
                j=0;
                k++;
            }
    }
    return ;
}
int length(char str[100000])
{
    int count=1;
    for(int i=0;i<strlen(str);i++)
    {
            if(str[i]==',')
            count++;
    }
    return count;
}
int main()
{
    char str1[100000],str2[100000];
    cin>>str1>>str2;
    int time1[1000],time2[1000];
    memset(time1,0,sizeof(time1));  memset(time2,0,sizeof(time2));
    change(time1,str1);  change(time2,str2);
    int len1,len2;
    len2=len1=length(str1);
    cout<<len1<<' ';
    int time[1001];
    memset(time,0,sizeof(time));
    for(int i=0;i<len1;i++)
    {
            for(int j=time1[i];j<time2[i];j++)   time[j]++;
    }
    int max=0;
    for(int i=0;i<1001;i++)
    {
            if(max<time[i])  max=time[i];
    }
    cout<<max<<endl;
    return 0;
}
int main()
{
	int in[1000],out[1000];
	int num=1,time=0,ma=0,s=0;
	while(1)
	{
		cin>>in[num];
		if(getchar()=='\n')
		{
			break;
		}
		else
		{
			num++;
		}
	}
	num=1;
	while(1)
	{
		cin>>out[num];
		if(getchar()=='\n')
		{
			break;
		}
		else
		{
			num++;
		}
	}
	for(time=1;time<=1000;time++)
	{
		s=0;
		for(int i=1;i<=num;i++)
			if(in[i]<=time&&out[i]>time)
				s++;
		if(ma<s)
			ma=s;
	}
	cout<<num<<" "<<ma<<endl;
	return 0;
}
int  num1[10000],num2[10000],n;

int main()
{
    char str;
    int temp=0,i,max=0,tmp,j;
    n=0;
    scanf("%c",&str);
    while(str != '\n')
    {
         if(str==',')
         {
               num1[n]=temp;
               temp=0;
               n++;   
         }
         else temp=temp*10+str-'0';  
         scanf("%c",&str);        
    }
    num1[n]=temp;
    n++;
    for(i=0;i<n;i++)
    {
          scanf("%d",&num2[i]);
          scanf("%c",&str);          
    }
   
   for(i=0;i<1000;i++)
   {
         tmp=0;
         for(j=0;j<n;j++)
         if(i>=num1[j] && i<num2[j])
              tmp++;
         if(tmp>max)
            max=tmp;             
   }
   printf("%d %d",n,max);
    
    return 0;
}
int main()
{
	int a[1001] = {0}, b[1001] = {0}, c[1001] = {0}, n, max = 0;
	char sign;
	n = 1;
	cin >> a[n];
	sign = cin.get();
	while (sign == ',')
	{
		n++;
		cin >> a[n];
		sign = cin.get();
	}
	n = 1;
	cin >> b[n];
	sign = cin.get();
	while (sign == ',')
	{
		n++;
		cin >> b[n];
		sign = cin.get();
	}
	for (int i = 1; i <= n; i++)
		for (int j = a[i]; j <= b[i] - 1; j++)
			c[j]++;
	for (int i = 1; i <= 999; i++)
		max = c[i] > max ? c[i]: max;
	cout << n << " " << max;
	return 0;
}
//********************************
//*????????   **
//*?????? 1300012713 **
//*???2013.10.31  **
//********************************
int main() 
{ 
	int a[1000][2],b[1010] = {0}, x, y, num = 1, max = 0;
	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 a[1000]={0},i=0,b[1000][2]={0},n=0,j,max;
	char c;
	do
	{
		scanf("%d%c",&b[i][0],&c);
		n++;
		i++;
	}while(c!='\n');
	i=0;
	c=0;
	do
	{
		scanf("%d%c",&b[i][1],&c);
		i++;
	}while(c!='\n');
	for(j=0;j<1000;j++)
	{
		for(i=0;i<n;i++)
		{
			if(j>=b[i][0]&&j<b[i][1]) a[j]++;
		}
	}
	max=a[0];
	for(i=1;i<1000;i++) if(max<a[i]) max=a[i];
	printf("%d %d",n,max);
}
int main()
{
	char temp;
	int c[1000],d[1000],i=0,j=0,t=0,k=0,count=0,max=0,sum;
	while(1)
	{
		cin >> c[i];
		temp=getchar();
			if(temp!=',')
				break;
			i++;
	}
	i=0;
	while(1)
	{
		cin >> d[i];
		temp=getchar();
			if(temp!=',')
				break;
			i++;
	}
	sum=i+1;
		cout << sum << " ";
	for(k=1;k<=1000;k++)
	{
		for(j=0;j<=sum-1;j++)
			if(c[j]<=k && d[j]>k)
				count++;
			if(count>max)
				max=count;
			count=0;
	}
	cout << max << endl;
	return 0;
}
int main()
{
	int a[1000], b[1000], sum=0, c[2000],max;
	char ch;
	for(int i=0;;i++)
	{
		cin >> a[i];
		sum++;
		ch=cin.get();
		if(ch=='\n')
			break;
		
	}
	for(int i=0;i<2000;i++)
		c[i]=0;
	for(int j=0;j<sum;j++)
	{
		cin >> b[j];
		ch = cin.get();
		for(int k=a[j];k<b[j];k++)
			c[k]++;
	}
	
	max=c[0];
	for ( int i = 0; i < 2000; i++ )

		if ( max < c[i] )

			max = c[i];
	





	cout << sum << " " << max << endl;

	return 0;
}
int main()
{
	char a[100000],b[100000];
	int count[1000]={0},i,c[1000],d[1000],k=0,m=0,max=0,j,ii;
	cin.getline(a,100000);
	cin.getline(b,100000);
	c[k++]=atoi(a);
	d[m++]=atoi(b);
	for(i=0;a[i]!='\0';i++)
	{
		if(a[i]==',')
			c[k++]=atoi(a+i+1);
	}
	for(i=0;b[i]!='\0';i++)
	{
		if(b[i]==',')
			d[m++]=atoi(b+i+1);
	}
	for(i=0;i<k;i++)
	{
		for(j=c[i];j<d[i];j++)
		{
			count[j]++;
		}
	}
	for(i=0;i<1000;i++)
	{
		if(count[i]>max)
		{
			max=count[i];
			ii=i;
		}
	}
	cout<<k<<" "<<max;
	return 0;
}
int main()
{
	int a[1000] = {0}, n = 0, x[1000] ={0}, y[1000]={0},k, m, j, t = 0;
	char b, c;
	for (n = 0; ; n++)
	{
		cin >> x[n];
		cin.get(b);
		if (b == '\n')
		{
			break;
		}
	}
	for (n = 0; ; n++)
	{
		cin >> y[n];
		cin.get(c);
		if (c == '\n')
		{
			break;
		}
	}
	for (k = 0; k <= n; k++)
	{
		for (j = x[k]; j < y[k]; j++)
		{
			a[j] ++;
		}
	}
	for (m = 0; m < 1000; m++)
	{
		if (t < a[m])
		{
			t = a[m];
		}
	}
	cout << n + 1 << " " << t << endl;
	return 0;
}
int main()
{
	int a[1010], b[1010], d[1010], i = 1, n;
	char c = ',';
	for(i = 1; i <= 1010; i++)
	{
		cin >> a[i];
		if(getchar() == '\n')
			break;
	}
	n = i;
	cin >> b[1];
	for(int j = 2; j <= n; j++)
		cin >> c >> b[j];
	for(int j = 1; j <= 1010; j++)
	{
		d[j] = 0;
		for(int k = 1; k <= n; k++)
		{
			if(a[k] <= j && b[k] > j)
				d[j]++;
		}
	}
	int max = d[1];
	for(int j = 2; j <= 1010; j++)
		max = max >= d[j]? max: d[j];
	cout << n << " ";
	cout << max << endl;
	return 0;
}
int main()
{
	int begin[10000]={' '},end[10000]={' '};			//begin and end array:record time
	int sum[10000]={' '};			//record amount of the people present at the same time
	int max_sum=0;
	int num_sum=0;
	char b[10]={' '};
	int i,j=0;		//cyclic variable
	char a[10000]={' '};			//read input
	char a1[10000]={' '};
			//next thirteen lines get the input
	cin.getline(a,10000);
	int length=strlen(a);
	for(i=0;i<=length;i++)
	{
		if((a[i]<='9')&&(a[i]>='0'))
		{
			b[j]=a[i];
			j++;
		}
		else
		{
			begin[num_sum]=atoi(b);
			num_sum++;
			for(int k=0;k<j;k++)
				b[k]='\0';
			j=0;
		}
	}
	num_sum=0;
	cin.getline(a1,10000);
	int length1=strlen(a1);
	for(i=0;i<=length1;i++)
	{
		if((a1[i]<='9')&&(a1[i]>='0'))
		{
			b[j]=a1[i];
			j++;
		}
		else
		{
			end[num_sum]=atoi(b);
			num_sum++;
			for(int k=0;k<j;k++)
				b[k]='\0';
			j=0;
		}
	}
	for(i=1;i<10000;i++)
		for(j=0;j<num_sum;j++)
			if((i>=begin[j])&&(i<end[j]))
				sum[i]++;

	for(i=1;i<10000;i++)
		if(sum[i]>max_sum)
			max_sum=sum[i];
	cout<<num_sum<<' '<<max_sum;
	return 0;
}
/**
* @file		?????.cpp
* @author	??	1000012792
* @date		2010.11.24
*/

int main()
{
	int x[1000], y[1000],num[1000]={0},start,end, max=0, count, i=1, j;
	//num?????i???????startend???????????max????????
	
	cin >> x[0];
	start = x[0];
	
	while(cin.get()==',')		//??x??????????????start
	{
		cin >> x[i];			
		if(x[i]<start)
			start = x[i];
		i++;
	}

	count = i;					//count?????????
	
	cin >> y[0];
	end = y[0];

	i = 1;
	while(cin.get()==',')		//??y??????????????end
	{
		cin >> y[i];
		if(y[i]>end)
			end = y[i];
		i++;
	}

	for(i=start;i<end;i++)		//?start??????end???????????????num[i]
	{
		for(j=0;j<count;j++)
		{
			if(x[j]<=i&&i<y[j])
				num[i]++;
		}
		if(num[i]>max)			//?num???????max
			max = num[i];
	}
	cout << count << " " << max;	//??count?max
	return 0;
}
int main()
{
	int a[1000][2],sum=0,min=100000000,max=0;
	char b;
	do{
		cin >>a[sum][0];
		if(a[sum][0]<min)
			min=a[sum][0];
		++sum;
		b=getchar();
	}while(b==',');
	for(int i=0;i<sum;i++)
	{
		cin >>a[i][1];
		if(a[i][1]>max)
			max=a[i][1];
		b=getchar();
	}
	cout <<sum <<" ";
	int m=0;
	for(int j=min;j<=max;j++)
	{
		int m1=0;
		for(int k=0;k<sum;k++)
			if(a[k][0]<=j&&a[k][1]>j)
				++m1;
		if(m1>m)
			m=m1;
	}
	cout << m <<endl;
	return 0;
}
int arr[1000000];
int brr[1000000];
int tot[1004];
int main()
{
	
	char a;
	int renshu=0,renshu1=0;
	char ch;
	while(1)
	{
		scanf("%d", &arr[renshu]);
		renshu++;
		ch=getchar();
		if(ch!=',')
			break;
	}
	while(1)
	{
		scanf("%d", &brr[renshu1]);	 
		renshu1++;
		ch=getchar();
		if(ch!=',')
			break;
	} 
	cout<<renshu<<" ";
    tot[0]=0;
	int i,j;
	for(i=1;i<=1000;i++)
	{
		for(j=0;j<renshu;j++)
		{
		   if(i>=arr[j] && i<brr[j])
			   tot[i]++;
		}
	}
    sort(tot,tot+1001);
	cout<<tot[1000]<<endl;
	return 0;
}
int main()
{
	int i,j,k,n=0;
	int x[1000]={0},y[1000]={0};
	int xmin,ymax;
	char c;
	int a[1000]={0};
	int max=1,man=0;

	for(i=0;i<1000;i++)
	{cin>>x[i];
	 cin.get(c);
	 n++;
	if(c=='\n')break;}

	for(i=0;i<1000;i++)
	{cin>>y[i];
	 cin.get(c);
	if(c=='\n')break;}

	xmin=x[0];ymax=y[0];
	for(i=0;x[i]!=0;i++)
	{
	 if(xmin>=x[i]){xmin=x[i];}
	 if(ymax<=y[i]){ymax=y[i];}
	}
	for(i=xmin;i<=ymax;i++)
	{
		for(j=0;j<n;j++)
		{
	      if((x[j]<=i&&i<y[j])||(x[j]==i))
		  {a[i]++;}
		}
	}
	for(i=0;i<n;i++)
	{man++;}

	for(i=xmin;i<=ymax;i++)
	{
		if(max<=a[i])max=a[i];
	}
	cout<<man<<" "<<max<<endl;
return 0;
}
int a[1000];
int b[1000];


int main()
{
	int n;
	char ch;
	//??
	int al=0;
	while(cin>>n)
	{
		a[al++]=n;
		cin.get(ch);
		if(ch=='\n')
			break;
	}
	//??
	int bl=0;
	while(cin>>n)
	{
		b[bl++]=n;
		cin.get(ch);
		if(ch=='\n')
			break;
	}
	//??
	int len=bl;
	//
	int max=0;
	for(int i=0; i < 999; i++)
	{
		int cnt=0;
		for(int j=0; j < len; j++)
		{
			if(i >= a[j] && i < b[j])
				cnt++;
		}
		if(cnt > max)
			max=cnt;
	}
	cout<<len<<" "<<max<<endl;

	return 0;
}
void main()
{
	int intime[1000],outtime[1000],trs[1000],i,j,k,a,b,c,rs,maxrs=0;
	for(i=0;;i++)
	{
		scanf("%d",&intime[i]);
		if((c=getchar())!=',') break;
	}
	rs=i+1;
	for(i=0;;i++)
	{
		scanf("%d",&outtime[i]);
		if((c=getchar())!=',') break;
	}
	for(i=0;i<1000;i++)
		trs[i]=0;
	for(i=0;i<rs;i++)
		for(j=intime[i];j<outtime[i];j++)
		trs[j]++;
	for(i=0;i<1000;i++)
		if(trs[i]>maxrs) maxrs=trs[i];

	printf("%d %d",rs,maxrs);
}
int main()
{
	int f[15000] = {0};
	int l[15000] = {0};
	int x[50000] = {0};
	char a[30000], b[30000];
	scanf("%s", a);
	scanf("%s", b);
	int along, blong, i = 0, u = 0, v = 0, max = 0;
	int num[30000] = {0};
	along = strlen(a);
	blong = strlen(b);
	while (u <= along - 1)
	{
		for (v = u; (a[v] != ',') && (a[v] != '\0'); v++)
		{
			num[i] = a[v] - '0';
			u++;
			f[i] = f[i] * 10 + num[i];
		}
		i = i + 1;
		u = u + 1;
	}
	u = 0;
	v = 0;
	i = 0;
	while (u <= blong - 1)
	{
		for (v = u; (b[v] != ',') && (b[v] != '\0'); v++)
		{
			num[i] = b[v] - '0';
			u++;
			l[i] = l[i] * 10 + num[i];
		}
		u++;
		i++;
	}
	int vmax = 0;
	for (u = 0; u <= i - 1; u++)
	{
		for (v = f[u]; v < l[u]; v++)
		{
			x[v] = x[v] + 1;
			if (vmax <= v)
			{
				vmax = v;
			}
		}
	}
	for (u = 0; u <= vmax + 1; u++)
	{
		if (max <= x[u])
		{
			max = x[u];
		}
	}
	cout << i << " " << max << endl;
	return 0;
}
int main()
{

	int a[1001], b[1001], d[1000] = {0}, n, max = 0; //a,b????????d???????????n?????max?????????
	char c; //????

	for(n = 1; n <= 1000; n++)
	{
		cin >> a[n];
		if(cin.get() == '\n') //??????????
			break;
	}

	//????????????
	cin >> b[1];
	for(int j = 2; j <= n; j++)
		cin >> c >> b[j];

	//????????????
	for(int j = 0; j < 1000; j++)
	{
		for(int k = 1; k <= n; k++)
			if(a[k] <= j && b[k] > j)
				d[j]++;
		max = max > d[j]? max: d[j]; //???????
	}
	
	cout << n << " " << max << endl;
	return 0;
}
int main()
{
	int i,a[1000],b[1000],num=0,l,j=0,c[1000]={0},max=0;
	char m[10000],n[10000],t[100];
	cin>>m>>n;
	l=strlen(m);
	for(i=0;i<=l;i++)
	{
		if(m[i]==','||m[i]=='\0')
		{
			num++;
			t[j]='\0';
			j=0;
			a[num]=atoi(t);
		}
		else
		{
			t[j]=m[i];
			j++;
		}
	}
	num=0;
	j=0;
	l=strlen(n);
	for(i=0;i<=l;i++)
	{
		if(n[i]==','||n[i]=='\0')
		{
			num++;
			t[j]='\0';
			j=0;
			b[num]=atoi(t);
		}
		else
		{
			t[j]=n[i];
			j++;
		}
	}
	cout<<num<<" ";
	for(i=0;i<1000;i++)
	{
		for(j=1;j<=num;j++)
		{
			if(i>=a[j]&&i<b[j])
				c[i]++;
		}
		if(max<c[i])
			max=c[i];
	}
	cout<<max;
	return 0;
}