semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
main()
{
	char a1[10000],a2[10000];
	int b[1000]={0},c[1000]={0};
	int i,j=0,k=0,l,r1,r2,m,n,p;
	gets(a1);
	gets(a2);
	r1=strlen(a1);
	r2=strlen(a2);
	for (i=0;i<r1;i++)
	{
		if (a1[i]!=',')
		{
			if (k==0) 
			{
				b[j]=a1[i]-48;
				k++;
			}
			else 
			{
				b[j]=b[j]*10+a1[i]-48;
			}
		}
		else
		{
			k=0;
			j++;
		}
	}
	j=0;
	for (i=0;i<r2;i++)
	{
		if (a2[i]!=',')
		{
			if (k==0) 
			{
				c[j]=a2[i]-48;
				k++;
			}
			else 
			{
				c[j]=c[j]*10+a2[i]-48;
			}
		}
		else
		{
			k=0;
			if (j==0) l=c[j];
			else if (c[j]>l) l=c[j];
			j++;
		}
	}
	printf("%d ",j+1);
	for (i=1;i<l;i++)
	{
		n=0;
		for (m=0;m<=j;m++)
		{
			if (b[m]<=i&&c[m]>i) n++;
		}
		if (i==1) p=n;
		else if (n>p) p=n;
	}
	printf("%d",p);
}
int main()
{
	int tim[1000], i, j, num, mac = 0;
	int star[1000],end[1000];
	for(i = 0; i < 1000; i++)
		tim[i] = 0;
	cin >> star[0];
	i = 1;
	while(cin.get() != '\n')
		cin >> star[i++];
	num = i;                        
	cin >> end[0];
	for(i = 1; i < num; i++)
	{
		cin.get();
		cin >> end[i];
	}
	for(i = 0; i < num; i++)
		for(j = star[i]; j < end[i]; j++)
			tim[j]++;
	for(i = 0; i < 1000; i++)
		mac = mac > tim[i] ? mac : tim[i];
	cout << num << " "<< mac << endl;
	return 0;
}
int main()
{
    int come[10000],go[10000],i=0,j=0;
    int num[1100]={0};
    char s;
    while(1)
    {
        s=getchar();
        if(s==',')
        {
            come[i]=j;
            i++;
            j=0;
        }
        else if(s=='\n')
        {
            come[i]=j;
            i++;
            j=0;
            break;
        }
        else
            j=j*10+s-'0';
    }
    i=0,j=0;
    while(1)
    {
        s=getchar();
        if(s==',')
        {
            go[i]=j;
            i++;
            j=0;
        }
        else if(s=='\n')
        {
            go[i]=j;
            i++;
            j=0;
            break;
        }
        else
            j=j*10+s-'0';
    }
    int n=i;
    printf("%d ",n);
    for(i=0;i<=1000;i++)
    {
        for(j=0;j<n;j++)
        if(i>=come[j]&&i<go[j])
        num[i]++;
    }
    int max=0;
    for(i=0;i<=1000;i++)
        if(num[i]>max)
            max=num[i];
    printf("%d\n",max);
    getchar();
    getchar();
}
int main()
{
	char c;
	int a[1000]={0},b[1000]={0},d[1000]={0},i=0,j,n=0,t=0;
	while((c=getchar())!='\n')
	{
		if(c==',') i++;
		else
		{
			a[i]*=10;
			a[i]+=(c-'0');
		}
	}
	n=i+1;
	i=0;
	while((c=getchar())!='\n')
	{
		if(c==',') i++;
		else
		{
			b[i]*=10;
			b[i]+=(c-'0');
		}
	}
	for(i=0;i<n;i++)
		for(j=a[i];j<b[i];j++)
			d[j]++;
	for(i=0;i<n;i++)
		if(b[i]>t)
			t=b[i];
	j=0;
	for(i=0;i<t;i++)
		if(d[i]>j)
			j=d[i];
	printf("%d %d",n,j);
	return 0;
}
int main()
{
	int tmax=0;
	int a[3][1001];
	cin>>a[1][1];
	int tmin=a[1][1];
	int sum=1;
	while(cin.get()==',')
	{
		cin>>a[1][sum+1];
		if(a[1][sum+1]<tmin)
			tmin=a[1][sum+1];
		sum++;
	}
	for(int i=1;i<sum;i++)
	{
		cin>>a[2][i];
		if(a[2][i]>tmax)
			tmax=a[2][i];
		getchar();
	}
	cin>>a[2][sum];
	if(a[2][sum]>tmax)
		tmax=a[2][sum];
	cout<<sum<<" ";
	int ren=0;
	for(int t=tmin;t<=tmax;t++)
	{
		int temp=0;
		for(int i=1;i<=sum;i++)
		{
			if(t>=a[1][i]&&t<a[2][i])
			{
				temp++;
			}
		}
		if(ren<temp)
			ren=temp;
	}
	cout<<ren;
	
	return 0;
}
//*************************
//*????????**
//*??????**
//*???2013.10.30**
//*************************
int main()
{
	int time[1050], in[1050], out[1050], i = 0, a = 0, n = 0;
	for(;i<=1049;i++)
	{
		time[i] = 0;
		in[i] = 0;
		out[i] = 0;
	}
	for(i = 0;;i++)
	{
		char a;
		cin>>in[i];
		a = cin.get();
		if(a != 44)
			break;
	}
	for(i = 0;;i++)
	{
		char b;
		cin>>out[i];
		b = cin.get();
		if(b != 44)
			break;
	}
	n = i + 1;
	for(i = 0;i <= 1000;i++)
	{
		for(int j = in[i]; j < out[i]; j++)
			{
				time[j]++;
		}
	}
for(int j = 0; j <= 1000 ; j++)                 
		for(int h = 0; h <=1000; h++)
			{
				if(time[h] < time[h+1])
				{
					int temp = time[h];
					time[h] = time[h+1];
					time[h+1] = temp;
				}
		}
		a = time[0];
	cout<<n<<" "<<a<<endl;
	return 0;
}
int main()
{
	int count[1000] = {0}, x[1000] = {0}, y[1000], num[1000], i = 1, j, k, most = 0;
	char ch[100000], t;
	cin >> ch;
	for (j = 0; ch[j] != '\0'; j++)
	{
		if (ch[j] == ',')
		{
			num[i] = j;
			i++;
		}
	}
	x[1] = ch[0] - 48;
	for (j = 1; j < num[1]; j++)
	{
		x[1] = 10 * x[1] + ch[j] - 48;
	}
	for (j = 2; j <= i; j++)
	{
		x[j] = ch[num[j - 1] + 1] - 48;
		if (j == i)
		{
			for (k = num[i - 1] + 2; ch[k] != '\0'; k++)
			{
				x[i] = 10 * x[i] + ch[k] - 48; 
			}
		}
		for (k = num[j - 1] + 2; k < num[j]; k++)
		{
			x[j] = 10 * x[j] + ch[k] - 48;
		}
	}
	cin >> y[1];
	for (j = x[1]; j < y[1]; j++)
	{
		count[j]++;
	}
	for (j = 2; j <= i; j++)
	{
		cin >> t >> y[j];
		for (k = x[j]; k < y[j]; k++)
		{
			count[k]++;
		}
	}
	for (j = 1; j < 1000; j++)
	{
		if (count[j] > most)
		{
			most = count[j];
		}
	}
	cout << i << " " << most << endl;
	return 0;
}
int main()
{
	int a[1000],b[1000],n,i,j;char c;
	i=0;
	while(i<1001)
	{
		scanf("%d%c",&a[i],&c);
		i++;
		if(c=='\n')
		{
			n=i;break;
		}
	}
	for(i=0;i<n;i++)
	{
		scanf("%d%c",&b[i],&c);
	}
	printf("%d ",n);
	int t=0,m=0;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<n;j++)
		{
			if(a[j]<=i&&b[j]>i)
			{
				t++;
			}
		}
		if(t>m)
		{
			m=t;
		}
		t=0;
	}
	printf("%d",m);
	return 0;
}
int main()
{
  int i,j,n,max=0,a[2000],b[2000];
  for(i=1; ;i++)
   {
    cin>>a[i];
    if(cin.get()=='\n') break;
   }
  for(j=1;j<=i;j++)
   {
   cin>>b[j];
   cin.get();
   }
   n=i;
  for(i=0;i<=999;i++)
   {
    int s=0;
    for(j=1;j<=n;j++)
     {
       if(a[j]<=i&&i<b[j])
         s=s+1;
     }
   if(s>max)
     max=s;
   }
 cout<<n<<" "<<max;
 return 0;
}
int main()
{
	int a[1001] = {0}, x[1000], y[1000];
    int i = 0, j = 0, k, u, l,counter, max = 0;
    char ch;

	do
	{
	    cin >> x[i];
		i++;
	}while((ch = cin.get()) == ',');
	do
	{
	    cin >> y[j];
		j++;
	}while((ch = cin.get()) == ',');
    for(k = 0; k < i; k++)
	{    
		for(u = x[k]; u < y[k]; u++)
		    a[u]++;
	}
	for(l = 0; l < 1001; l++)
	{
	    if(a[l] > max)
			max = a[l];
	}
	cout << i << " " << max << endl;
	    return 0;
}
//**************************
//*????????        **
//*?????? 1300012863 **
//*???2013.11.1        **
//**************************
int main()  
{ 
	int x[1005],y[1005],c[1005],d[1005];                //???????x??????y?????
	char ch;
	int i,p,n,a;
	for(i=1; ;i++)                      //?????????
	{
		cin>>x[i];
		ch=cin.get();
		c[i]=x[i];
		if(ch!= ',')
		{break;}
	}
	for(a=1; ;a++)                      //?????????
	{
		cin>>y[a];
		ch=cin.get();
		d[a]=y[a];
		if(ch!= ',')
		{break;}
	}
		for(int m=1;m<=i-1;m++)         //??????????????? 
		{
			if(x[m]<x[m+1])
			{
				p = x[m];
				x[m] = x[m+1];
				x[m+1] = p;
			}
		}
		for(int m=1;m<=i-1;m++)        //???????????????
		{
			if(y[m]>y[m+1])
			{
				p = y[m];
				y[m] = y[m+1];
				y[m+1] = p;
			}
		}
		for(int m=1;m<=i-2;m++)        //????????????????
		{
			if(y[m]>y[m+1])
			{
				p = y[m];
				y[m] = y[m+1];
				y[m+1] = p;
			}
		}
	int h[1005];
	for(int k=x[i];k<=y[i-1];k++)            //?????????????,???????h?
	{
		n = 0;
		for(int p=1;p<=i;p++)
		{
			if((c[p]<=k)&&(k<d[p]))
			{
				n = n + 1;
			}
		}
		h[k] = n;
	}
    for(int j=x[i];j<=(y[i-1]-1);j++)             //???????????h????             
	{
			if(h[j]>h[j+1])
			{
				p = h[j];
				h[j] = h[j+1];
				h[j+1] = p;
			}
	}
    cout<<i<<" ";                       //????????
	cout<<h[y[i-1]];
	return 0;
}
int main()
{
	char y[2][1000];
	int x[2][1000] , i , j , k , count[1000] = {0} , max = 0;
		
	for(k = 0; k < 2; k ++)
	{
		i = 0;
		cin >> x[k][0];
		while ((y[k][i] = cin.get()) == ',')
		{
			i ++;
			cin >> x[k][i];
		}
	}

	for(k = 0; k < 1000; k ++)
	{
		for (j = 0; j < i + 1; j ++)
			if(k >= x[0][j] && k < x[1][j])
				count[k] ++;

		if (count[k] > max)
			max = count[k];
	} 
	cout << i + 1 << " " << max << endl;

	return 0;
}
int main()
{
	int intime[9999],outtime[9999],count=0,sum[1000]={0};
	//intime???????outtime???????count?????sum?????????
	char temp;
	int i=0,j=0,max=0;//????i,j?max?????

	while (1) //?????
	{
		cin>>intime[count];
		cin.get(temp);
		if (temp!='\n')  count++;
		else { count++; break;}
	}
	count=0;
	while (1)  //?????
	{
		cin>>outtime[count];
		cin.get(temp);
		if (temp!='\n')  count++;
		else { count++; break;}
	}

	for (i=0;i<count;i++)
	{
		for (j=intime[i];j<outtime[i];j++)
			sum[j]++;
	}
	
	for (i=0;i<1000;i++)
	{
		if ( sum[i]>max) max=sum[i];
	}

	cout<<count<<" "<<max<<endl;
	

return 0;}
void main()
{   int p[1000],q[1000],i=0,j,n,max=0,a[1000]={0},m=0;
    char c;
    do
{   scanf("%d%c",&p[i],&c);
     i++;
}   while(c==',');
    n=i;
    for(j=0;j<n;j++)
{   scanf("%d",&q[j]);
    c=getchar(); 
}   for(i=0;i<n;i++)
    if(max<q[i]) max=q[i];
   for(i=2;i<=max;i++) 
   for(j=0;j<n;j++)
{  if(p[j]<=i&&q[j]>i) a[i]++;
}  for(i=0;i<1000;i++)
{  if(m<a[i])m=a[i];
} printf("%d %d",n,m);
}
int main()
{
	int a[1000], i = 0, b[1000] = {0}, j = 0, k, l;
	char ch = ',';
	while (ch == ',')
	{
		cin >> a[i++];
		ch = cin.get();
	}
	cout << i << ' ';
	while (j < i)
	{
		cin >> k;
		ch = cin.get();
		for (l = a[j]; l < k; l++)
			b[l]++;
		j++;
	}
	k = 0;
	for (i = 0; i < 1000; i++)
		k = (k > b[i]) ? k : b[i];
	cout << k;
	ch = cin.get();
	return 0;
}
int main()
{
	int qiumax(int s[1005],int n);
	int a[1005]={0},b[1005]={0},i=0;
	char c;
	do
	{
		i++;
		scanf("%d",&a[i]);
		c=getchar();
	}
	while(c!='\n');
	int num=i;
	for(i=1;i<=num;i++)
	{scanf("%d",&b[i]);c=getchar();}
	int cnt[1002]={0},j,maxb=qiumax(b,num);
	for(i=1;i<=num;i++)
	{
		for(j=a[i];j<b[i];j++)
			cnt[j]++;
	}
	int maxpeople=qiumax(cnt,maxb-1);
	printf("%d %d",num,maxpeople);
	return 0;
}

int qiumax(int s[1005],int n)
{
	int i,max=0;
	for(i=0;i<=n;i++)
	{
		if(s[i]>max)
			max=s[i];
	}
	return max;
}
int main()
{
	int a[2][1000]={0},i,j=0,k,n,p=0,max=0;
	char q;
	for(i=0;i<2;i++)
	{
		j=0;
		do
		{
			cin>>a[i][j];
			j++;
		}
		while((q=cin.get())!='\n');	
	}
    for(k=0;k<=1000;k++)
	{
		for(n=0;n<j;n++)
		{
			if(a[0][n]<=k&&a[1][n]>k)
				p=p+1;
		}
		if(p>max)max=p;
		p=0;
	}
	cout<<j<<" "<<max<<endl;
	return 0;
}
int convert(int a,int b,char str[])
{
	int i,m=0;
	for(i=a+1;i<b;++i)
		m=m*10+(str[i]-'0');
	return(m);
}
main()
{
	char str[5000];
	int len,i,j,count=1,comma[2000],max;
	gets(str);
	len=strlen(str);
	comma[0]=-1;
	for(i=0;i<len;++i)
		if(str[i]==',')
		{
			comma[count]=i;
			count++;
		}
	comma[count]=len;
	int a[2000],b[2000],c[2000];
	for(i=0;i<1000;++i)
		c[i]=0;
	for(i=0;i<count;++i)
		a[i]=convert(comma[i],comma[i+1],str);
	scanf("%d",&b[0]);
	for(i=1;i<count;++i)
		scanf(",%d",&b[i]);
	for(i=0;i<1000;i++)
		for(j=0;j<count;++j)
			if(i>=a[j]&&i<b[j])
				c[i]++;
	max=c[0];
	for(i=1;i<1000;++i)
		if(c[i]>max)
			max=c[i];
	printf("%d %d",count,max);
}
/*
 * qimofuxi8.cpp
 *
 *  Created on: 2010-12-22
 *      Author: l
 */
int main(){
	char a1[10000],a2[10000];
	cin.getline(a1,10000);
	cin.getline(a2,10000);
	int l1,l2,i,j,n=0;
	l1=strlen(a1);
	l2=strlen(a2);//?????????????
	for(i=0;i<l1;i++)
		if(a1[i]==',')
			n=n+1;
	n=n+1;//???????????
	int b1[n],b2[n];
	for(i=0;i<n;i++)
		b1[i]=0;
	j=0;
	for(i=0;i<l1;i++)
		if(a1[i]==',')
			j++;
		else
			b1[j]=b1[j]*10+a1[i]-'0';//???a1???????????b1

	for(i=0;i<n;i++)
			b2[i]=0;
		j=0;
		for(i=0;i<l2;i++)
			if(a2[i]==',')
				j++;
			else
				b2[j]=b2[j]*10+a2[i]-'0';//????a2??????????b2




	int k=0,max=0;
	for(int t=0;t<1000;t++)
	{
		k=0;
		for(i=0;i<n;i++)
			if((b1[i]<=t)&&(b2[i]>t))
				k=k+1;
	if(k>max)
		max=k;//???????
	}
	cout<<n<<" "<<max<<endl;//

	return 0;
}
//******************
//???5         **
//??????    **
//???2013.10.31**
//******************
int main()
{
	int come[2000],leave, num = 1, max, c[2000];

	memset( c, 0, sizeof(c) );

	char ch;

	for ( int i = 0; ; i++ )
	{
		cin >> come[i];

		ch = cin.get();

		if ( ch == '\n' )

			break;

		num++;
	}
	for ( int i = 0; i < num; i++ )
	{
		cin >> leave;

		ch = cin.get();

		for ( int j = come[i]; j < leave; j++ )

			c[j]++;
	}
	max = c[0];

	for ( int i = 0; i < 1003; i++ )

		if ( max < c[i] )

			max = c[i];

	cout << num << " " << max << endl;

	return 0;
}
/**
 * @file   5.cpp
 * @author ???
 * @date   2013-10-30
 * @description
 *         ????????????
 */



int main()
{
	int a[1000], b[1000], t[1000] = {0}, k = 1, c = 0;    // ??a?b??????????t????????????

	cin >> a[0];
	
	while (cin.get() == ',')                   // ??????????????????i??????
	{
		cin >> a[k];
		++k;
	}

	cout << k;                                 // ?????????

	cin >> b[0];

	k = 1;

	while (cin.get() == ',')                   // ???i??????
	{
		cin >> b[k];
		++k;
	}

	for (int i = 0; i < k; ++i)                // ????????????
	{
		for (int j = a[i]; j < b[i]; ++j)
			++t[j];
	}

	for (int n = 1; n < 1000; ++n)             // ????????????
	{
		if (t[n] > t[c]) c = n;		
	}

	cout << " " << t[c];

	return 0;
}
int main()
{
	char str1[10000],str2[10000],temp[5];
	int le1,le2,k=0,i,m,a[10000],b[10000],c[10000]={0},j,max;
	cin>>str1;
	cin>>str2;
	le1=strlen(str1);
	le2=strlen(str2);
	for(i=0;i<=le1-1;i++)
	{
		if((str1[i-1]==','&&i-1>=0)||(i==0))
		{
		   for(j=0;j<=4;j++)
		   {
			   if(str1[j+i]!=',')
				   temp[j]=str1[j+i];
			   if(str1[j+i]==',')
				   break;
		   }
		   temp[j]='\0';
		   a[k]=temp[0]-'0';
		   for(m=1;m<strlen(temp);m++)
			   a[k]=10*a[k]+temp[m]-'0';
		   k++;
		}
	}
	k=0;
	for(i=0;i<=le2-1;i++)
	{
		if((str2[i-1]==','&&i-1>=0)||(i==0))
		{
			for(j=0;j<=4;j++)
			{
				if(str2[j+i]!=',')
					temp[j]=str2[j+i];
				if(str2[j+i]==',')
					break;
			}
			temp[j]='\0';
			b[k]=temp[0]-'0';
			for(m=1;m<strlen(temp);m++)
				b[k]=10*b[k]+temp[m]-'0';
			k++;
		}
	}
	cout<<k<<" ";
	for(i=0;i<=1000;i++)
	   for(j=0;j<=k-1;j++)
	   {
		   if(a[j]<=i&&i<b[j])
			   c[i]++;
	   }
	max=c[0];
	for(i=0;i<=1000;i++)
		if(max<c[i])
			max=c[i];
	cout<<max;
	return 0;
}
void main()
{
	int i=0,j,k,l,m,n,t[1002];
	int a[1800],b[1800];
	char fei=',';
	while(fei==',')
	{
		scanf("%d",&a[i]);
		fei=getchar();	
		i++;
	}
	i=0;
	fei=',';
	while(fei==',')
	{
		scanf("%d",&b[i]);
		fei=getchar();	
		i++;
	}
	l=i;
	for(i=0;i<1002;i++)
	{
		t[i]=0;
		for(j=0;j<l;j++)
			if(a[j]<=i&&b[j]>i)
				t[i]++;
	}
	int max=t[0];
	for(i=0;i<1002;i++)
	{
		if(t[i]>max)
			max=t[i];
	}
	printf("%d %d",l,max);
}
int main()
{
	int a[1001][2],i,j,count,n,num=0;
	char c=',';
	for(i=1;c==',';i++)
		cin>>a[i][0]>>c;
	n=i-1;
	a[1][1]=c-'0';
	cin>>c;
	while (c!=',')
	{
		a[1][1]=a[1][1]*10+c-'0';
		cin>>c;
	}
	for(i=2;i<=n-1;i++)
		cin>>a[i][1]>>c;
	cin>>a[n][1];
	
	int min, max;
	min=a[1][0];
	max=a[1][1];
	for(i=2;i<=n;i++)
	{
		if(a[i][0]<min)
			min=a[i][0];
		if(a[i][1]>max)
			max=a[i][1];
	}
	for(i=min; i<=max-1;i++)
	{
		count=0;
		for(j=1;j<=n;j++)
		{
			if(i>=a[j][0]&&i<a[j][1])
				count++;
		}
		if(count>num)
			num=count;
	}

	cout <<n<<" "<<num;
	return 0;
}
//******************************
//???:5.cpp
//??: ??? 1300012754
//??:2013.10.30
//??:?????
//******************************
int main()
{
	int num = 0;
	int x[1010], y[1010];
	int time[1010];
	int maxpeople = 0;
	char ch;
	int i = 0;
	memset(time, 0, sizeof(time));
	memset(x, 0, sizeof(x));
	memset(y, 0, sizeof(y));
	do
	{
		i++;
		cin >> x[i];
		ch = cin.get();
		num++;
		if(ch != ',')
			break;
	}while(1);
	i = 0;
	do
	{
		i++;
		cin >> y[i];
		ch = cin.get();
		if(ch != ',')
			break;
	}while(1);
	for (int k = 1; k <= num; k++)
	{
		for (int j = x[k]; j < y[k]; j++)
		{
			time[j]++;
		}
	}
	for (int k = 0; k < 1000; k++)
	{
		if (maxpeople < time[k])
			maxpeople = time[k];
	}
	cout << num << " " << maxpeople << endl;
	return 0;
}
void main()
{
	int i=0,j=0,x[1000]={0},y[1000]={0},n=0,k,min=1000,max=0,m=0,l;
	char a;
	while(1)
	{
		scanf("%d",&x[i]);
		i++;
		a=getchar();
		if(a=='\n')
			break;
	}

	while(1)
	{
		scanf("%d",&y[j]);
		j++;
		a=getchar();
		if(a=='\n')
			break;
	}
	for(k=0;k<i;k++)
		if(x[k]<min)
			min=x[k];
	for(k=0;k<j;k++)
		if(y[k]>max)
			max=y[k];
	for(k=min;k<max;k++)
	{
		n=0;
		for(l=0;l<i;l++)
		{
			if(x[l]<=k&&y[l]>k)
				n++;
		}
		if(n>m)
			m=n;
	}
	printf("%d %d",i,m);


}
int main()
{
	int n[1000][2],i=0,j=0,count=0,m[1000]={0},max=0,flag=0,t=0;
	do
	{
		cin>>n[i][0];
		m[n[i][0]]++;
		i++;
		count++;
	}
	while(cin.get()==',');
	i=0;
	do
	{
		cin>>n[i][1];
		m[n[i][1]]=m[n[i][1]]-1;
		i++;
	}
	while(cin.get()==',');
	for(i=0;i<1000;i++)
	{
		if(m[i]!=0)
		{
			if(flag==0)
			{
				t=m[i];
				flag=1;
			}
			else
			{
				m[i]+=t;
				t=m[i];
			}
		}
		else
			continue;
		if(max<m[i])
		{
			max=m[i];
		}
	}
	cout<<count<<' '<<max<<endl;
	return 0;
}
int main()
{
  char c;
  int m,n=1,i;
  int a[1001]={0};
  scanf("%d",&m);
  for(i=m;i<1000;i++)
	  a[i]++;
  scanf("%c",&c);
  while(c!='\n')
  {
	  scanf("%d",&m);
      for(i=m;i<1000;i++)
	  a[i]++;
	  scanf("%c",&c);
	  n++;
}
   scanf("%d",&m);
  for(i=m;i<1000;i++)
	  a[i]--;
   scanf("%c",&c);
   while(c!='\n')
  {
	  scanf("%d",&m);
      for(i=m;i<1000;i++)
	  {a[i]--;
	 
	  }
	  scanf("%c",&c);
   }  m=0;
   for(i=1;i<1000;i++)
	   if(a[i]>m)m=a[i];
	   printf("%d %d",n,m);
}
int main()
{
	char a;
	int x[1000], y[1000], hour[1000] = {0}, peo = 0, temp;

	for (int i = 0; i < 1000; i++)
	{
		cin >> x[i];
		cin.get(a);
	    peo++;
		if (a == '\n') break;
	}
	for (int j = 0; j <= peo; j++)
	{
		cin >> y[j];
		cin.get(a);
		if (a == '\n') break;
	}
	for (int k = 0; k < peo; k++)
	{
		for (int p = x[k]; p < y[k]; p++)
		{
			hour[p]++;
		}
	}
	for (int m = 0; m < 1000; m++)
	{

		if (hour[m] > hour[m + 1])
		{
			temp = hour[m + 1];
			hour[m + 1] = hour[m];
			hour[m] = temp;
		}
	}

	cout << peo << ' ' << hour[999];

	return 0;
}
int a[1000]={0},b[1000]={0};
int zhuan1(char c[])
{
	int i,j=0;
	for(i=0;i<strlen(c);i++)
	{
		if(c[i]!=',')
			a[j]=a[j]*10+c[i]-'0';
		else j=j+1;
	}
	return(j+1);
}
int zhuan2(char c[])
{
	int i,j=0;
	for(i=0;i<strlen(c);i++)
	{
		if(c[i]!=',')
			b[j]=b[j]*10+c[i]-'0';
		else j=j+1;
	}
	return(j+1);
}
void main()
{
	int i,j,k,l,m,n,max=0,g[1000]={0},gmax=0;
	char c[10000],d[10000];
	gets(c);
	gets(d);
	m=zhuan1(c);
	n=zhuan2(d);
	for(i=0;i<n;i++)
		if(b[i]>max)
			max=b[i];
	for(i=0;i<max;i++)
		for(j=0;j<n;j++)
			if(i>=a[j]&&i+1<=b[j])
				g[i]=g[i]+1;
	for(i=0;i<max;i++)
		if(g[i]>gmax)
			gmax=g[i];
	printf("%d %d",n,gmax);


}
//*************************************************
//***????????***
//***??????***
//***???2012.11.10***
//*************************************************
int main ()
{
	int i,j,k,p,max = 0,x[1000],y[1000];
	char a;
	i = 0;
	cin >> x[0];
	while (1)
	{
		a = cin.get();
		if (a == '\n') break;
		cin >> x[++i];
	}
	i = 0;
	cin >> y[0];
	while (1)
	{
		a = cin.get();
		if (a == '\n') break;
		cin >> y[++i];
	}
	for(k = 0; k < 1000; k++)
	{
		p = 0;
		for (j = 0; j <= i; j++)
		{
			if (x[j] <= k && y[j] > k)
				p++;
		}
		if (p > max)
			max = p;
	}
	cout << i + 1 << " " << max << endl;
	return 0;
}
int main()
{
	int max = 0, n = 0, x[1000], y[1000], s[1000] = {0}, i = 0, j;
	char c;
	while(cin >> x[n])
	{
		cin.get(c);
		n++;
		if(c != ',')
			break;
	}
	cin >> y[0];
	for(i = 1; i < n; i++)
	{
		cin >> c;
		cin >> y[i];
	}
	for(i = 0; i < n; i++)
	{
		for(j = x[i]; j < y[i]; j++)
			s[j]++;
	}
	for(i = 0; i < 1000; i++)
		if(max < s[i])
			max = s[i];
	cout << n <<" " << max << endl;
	return 0;
}
struct p{
	int in;
	int out;
}a[1000];

void main()
{
	int i,n,j,max;
	int t[1000]={0};
	scanf("%d",&a[0].in);
	i=1;
	while(scanf(",%d",&a[i++].in)==1);
	scanf("%d",&a[0].out);
	i=1;
	while(scanf(",%d",&a[i++].out)==1);
	n=i-1;

	for(j=0;j<999;j++){
		for(i=0;i<n;i++){
			if(a[i].in<=j&&a[i].out>=j+1)
				t[j]++;
		}
	}
	//max//
	for(j=0;j<999;j++){
		if(j==0)
			max=t[j];
		else if(t[j]>max)
			max=t[j];
	}
	//print//
	printf("%d %d\n",n,max);
}
int t[1005];
int in[1000];
int out[1000];
void main()
{
	char buf[4000], *p;
	int count;
	int i,j;
	int max=0;

	memset(t, 0, sizeof(t));

	fgets(buf, sizeof(buf), stdin);
	i=0;
	p = strtok(buf, ",");
	for (; p; p=strtok(NULL, ","))
	{
		in[i++] = atoi(p);
	}
	count = i;

	fgets(buf, sizeof(buf), stdin);
	i=0;
	p = strtok(buf, ",");
	for (; p; p=strtok(NULL, ","))
	{
		out[i++] = atoi(p);
	}

	for (i=0; i<count; i++)
	{
		int s=in[i];
		int e=out[i];
		for(j=s; j<e; j++)
		{
			t[j] ++;
			if (max<t[j])
				max=t[j];
		}
	}
	
	printf("%d %d\n",count, max);
}
int main()
{
	int a[1000], b[1000], t[1000] = {0};
	int i, j, count, maxNum = 0;
	i = 0;
	do
	{
		cin >> a[i];
		i++;
	} while (cin.get() != '\n');
	count = i;
	i = 0;
	do
	{
		cin >> b[i];
		i++;
		cin.get();
	} while (i < count);
	for (i = 0; i < count; i++)
		for (j = a[i]; j < b[i]; j++)
			t[j]++;
	for (i = 0; i < 1000; i++)
		if (t[i] > maxNum)
			maxNum = t[i];
	cout << count << " " << maxNum;
	return 0;
}
//?????
//??????
//???2010.11.27

int main()
{
	int i = 0;
	double j = 0.0;
	char a[10000];         //???a,b?????????","
	char b[10000];
	int begin[10000];      //?????????????begin,end?
	int end[10000];
	int p = 0;
	int q = 0;
	int last_time = 0;   //??last_time?????????
	int max = 0;         //??max????????????
	int count = 0;
	int flag = 0;

	memset(a,0,sizeof(a));    //????
	memset(b,0,sizeof(b));
	memset(begin,0,sizeof(begin));
	memset(end,0,sizeof(end));

	cin.getline(a,10000);
	cin.getline(b,10000);



	for (i = 0; i <= 10000; i ++)     //????????
	{
		if ((a[i] != ',') && (a[i] != '\0'))
			flag ++;
		if ((a[i] == ',') || (a[i] == '\0'))
		{
			if (flag == 3)             //???????????begin[i]???
				begin[p ++] = a[i - 1] - '0' + 10 * (a[i - 2] - '0')
				+ 100 * (a[i - 3] - '0');
			if (flag == 2)
				begin[p ++] = a[i - 1] - '0' + 10 * (a[i - 2] - '0');
			if (flag == 1)
				begin[p ++] = a[i - 1] - '0';
			flag = 0;
		}
		if (a[i] == '\0')
			break;
	}
	for (i = 0; i <= 10000; i ++)
	{
		if ((b[i] != ',') && (b[i] != '\0'))
			flag ++;
		if ((b[i] == ',') || (b[i] == '\0'))
		{
			if (flag == 3)
				end[q ++] = b[i - 1] - '0' + 10 * (b[i - 2] - '0')
				+ 100 * (b[i - 3] - '0');
			if (flag == 2)
				end[q ++] = b[i - 1] - '0' + 10 * (b[i - 2] - '0');
			if (flag == 1)
				end[q ++] = b[i - 1] - '0';
			flag = 0;
		}
		if (b[i] == '\0')
			break;
	}

	for (i = 0; i <= p - 1; i ++)     //?????????
		if (end[i] > last_time)
			last_time = end[i];
	for (j = 0.5; j <= last_time - 0.5; j ++)    //????????????
	{
		count = 0;
		for (i = 0; i <= p - 1; i ++)
			if ((begin[i] < j) && (end[i] > j))
				count ++;
		if (count > max)
			max = count;
	}

	cout << p << " " << max;
	cin >> i;

	return 0;
}
int main()
{
    int x[10000] , y[10000];
    char ch1[10000] , ch2[10000];   
    int i = 0 , j = 0 , n = 0;
    int Min_h = 1000 , Max_h = 0 , Max = 0;
    cin >> ch1;
    cin >> ch2;
    int comma = -1;
    int counter = 0 , number = 0;
    for( i = 0 ; i <= 9999 ; i ++ )
    {
         if( ch1[i] == '\0' || ch1[i] == ',' )
         {
              if( i - comma == 2 )
                  x[counter] = ch1[i - 1] - '0';     
              else if( i - comma == 3 )
                   x[counter] = ( ch1[i - 2] - '0' ) * 10 + ch1[i - 1] - '0';
              else if( i - comma == 4 )
                   x[counter] = ( ch1[i - 3] - '0' ) * 100 + ( ch1[i - 2] - '0' ) * 10 + ch1[i - 1] - '0';
              counter ++;
              comma = i;
              if( ch1[i] == '\0' )
                  break;
         }   
    }
    comma = -1;
    counter = 0;
    for( i = 0 ; i <= 9999 ; i ++ )
    {
         if( ch2[i] == ',' || ch2[i] == '\0' )
         {
              if( i - comma == 2 )
                  y[counter] = ch2[i - 1] - '0';     
              else if( i - comma == 3 )
                   y[counter] = ( ch2[i - 2] - '0' ) * 10 + ch2[i - 1] - '0';
              else if( i - comma == 4 )
                   y[counter] = ( ch2[i - 3] - '0' ) * 100 + ( ch2[i - 2] - '0' ) * 10 + ch2[i - 1] - '0';
              counter ++;
              comma = i;
              if( ch2[i] == '\0' )
                  break;
         }   
    }
    for( i = 0 ; i <= counter - 1 ; i ++ )
    {
         if( x[i] < Min_h ) Min_h = x[i] ;
         if( y[i] > Max_h ) Max_h = y[i] ;     
    }
    for( i = Min_h ; i <= Max_h ; i ++ )
    {
         number = 0;
         for( j = 0 ; j <= counter - 1 ; j ++ )     
         {
              if( x[j] <= i && y[j] > i )
              number ++;
         }
         if( number > Max )
             Max = number;
    }
    cout << counter << " " << Max << endl;
    return 0;
}