semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int a[10000],b[10000],i,j,k,s[10000]={0},q,maxr,p,mint,maxt,x,y;
	char c;
	for (i=0;;i++)
	{
		cin>>a[i];
		if ((c=cin.get())=='\n')
		break;
	}
	for (j=0;;j++)
	{
		cin>>b[j];
		if ((c=cin.get())=='\n')
			break;
	}
	mint=a[0];
	for (x=1;x<=i;x++)
	{
		if (a[x]<mint)
			mint=a[x];
	}
	maxt=b[0];
	for (y=1;y<=i;y++)
	{
		if (b[y]>maxt)
			maxt=b[y];
	}
	for (k=mint;k<=maxt-1;k++)
	{
		for (p=0;p<=i;p++)
		{
			if (k>=a[p]&&k<b[p])
				s[k]=s[k]+1;
		}
	}
	maxr=s[mint];
	for (q=mint+1;q<=maxt-1;q++)
	{
		if (maxr<s[q])
			maxr=s[q];
	}
	cout<<i+1<<" "<<maxr<<endl;
	return 0;
}
int power(int,int);
int main()
{
	int i,j,k,h,g,len1,len2,x[1002] = {0},y[1002] = {0},num[1000] = {0},max,pos;
	char ch1[10000],ch2[10000];
	cin >> ch1 >> ch2;
	len1 = strlen(ch1);
	len2 = strlen(ch2);
	k = 0;
	for(i = 0; i <= len1; i++)
	{
		if((ch1[i] == ',')||(ch1[i] == '\0'))
		{
			g = 0;
			for(j = i - 1; j >= 0; j--)
			{
				if(ch1[j] != ',')
				{
					x[k] = x[k] + (ch1[j] - '0') * power(10,g);
					g++;
				}
				if(ch1[j] == ',')
					break;
			}
			k++;
		}
	}
	k = 0;
	for(i = 0; i <= len2; i++)
	{
		if((ch2[i] == ',')||(ch2[i] == '\0'))
		{
			g = 0;
			for(j = i - 1; j >= 0; j--)
			{
				if(ch2[j] != ',')
				{
					y[k] = y[k] + (ch2[j] - '0') * power(10,g);
					g++;
				}
				if(ch2[j] == ',')
					break;
			}
			k++;
		}
	}
	for(i = 1; i < 1000; i++)
	{
		for(j = 0; j < k; j++)
		{
			if((x[j] <= i)&&(i < y[j]))
				num[i]++;
		}
	}
	max = 0;
	for(i = 1; i < 1000; i++)
	{
		if(num[i] > max)
		{
			max = num[i];
			pos = i;
		}
	}
	cout << k << " " << max;
	return 0;
}
int power(int a,int b)
{
	int sum = 1,i;
	for(i = 1; i <= b; i++)
		sum = sum * a;
	return sum;
}
int main()
{
	int p,i=1,j,k=1,a[1002],b[1002],count,max1=0,max=0,min=1004;  //n?????p????????
	char c;
	do
	{	
		cin >> a[i];
		c=cin.get();
		if (a[i]<min)
			min=a[i];
		i++;
	} while (c==',');
	p=i-1;
	i=1;
	do
	{
		cin >> b[i];
		c=cin.get();
		if (b[i]>max)
			max=b[i];
		i++;
	} while (c==',');		
	for (i=min;i<=max;i++)
	{
		count=0;
		for (j=1;j<=p;j++)
		{
			if (a[j]<=i&&b[j]>=(i+1))
				count++;
		}
		if (count>max1)
			max1=count;
	}
	cout << p << " " << max1 << endl;
	return 0;
}
void main()
{
int k=0,a[1000],b[1000],t[1000],i=0,p=0,j;char c=',';
while(c==',')  {scanf("%d%c",&a[i],&c); p++;i++;}c=',';i=0;
while(c==',')  {scanf("%d%c",&b[i],&c); i++;}
for(i=0;i<999;i++)   t[i]=0;
for(i=0;i<999;i++)
 for(j=0;j<p;j++)    if((a[j]<=i)&&(b[j]>i))  t[i]++;
for(i=0;i<999;i++)
if(t[i]>k)   k=t[i];
printf("%d %d",p,k);
}
int main()
{
    int a[1001],b[1001],c[1001] = {0},i,sum,k,j,m,s,max = 0;
    char d;
    for (i = 1;;i++)
    {
        cin >> a[i];
        d = cin.get();
        if (d != ',')
        break;
    }
    sum = i;
    for (k = 1;k <= i;k++)
    {
        cin >> b[k];
        d = cin.get();
    }
    for (j = 1;j <= i;j++)
        for (m = a[j];m < b[j];m++)//??c[m]??m???????? ????????????????
        {
           c[m]++;
        }
    for (s = 0;s <= 1000;s++)
    {
        if (c[s] >= max)
        max = c[s];
    }
    cout << sum << " " << max;
   
    return 0;
}
void main()
{
int k,j,a[1001],b[1001],t[1001],i=0,max=0;char c=',';
while(c==',')  {scanf("%d%c",&a[i],&c);i++;}
i=0; c=',';
while(c==',')  {scanf("%d%c",&b[i],&c);i++;}
for(j=0;j<1000;j++)    
{t[j]=0;
for(k=0;k<i;k++)   if((j>=a[k])&&(j<b[k]))   t[j]++;}
for(j=0;j<1000;j++)    if(t[j]>max)  max=t[j];
printf("%d %d",i,max);
}
int main(){
	int a[1000],b[1000],d[1000],i,j,p;
	char c[1000];
	for(i=0;;i++){
		cin>>a[i];
		if(cin.get()!=','){
			i++;
			break;
		}
	}
	for(j=0;j<i;j++){
		cin>>b[j];
		cin.get(c[j]);
	}
	for(j=0;j<i;j++){
		for(p=a[j];p<b[j];p++){
			d[p]++;
		}
	}
	p=0;
	for(j=0;j<1000;j++)
		if(d[j]>p)
			p=d[j];
	cout<<i<<" "<<p<<endl;
	return 0;
}
int main()
{
	int begin[1000],end[1000],i=0,j=0,sum=0,max=0,k;
	char dot=',';
	while (dot==',')
	{
		cin >> begin[i];
		i++;
		dot=cin.get();
	}
	while (cin>>end[j])
	{
		j++;
		dot=cin.get();
		if(dot!=',')
			break;
	}
	for(k=0;k<1000;k++)
	{
		for(i=0;i<j;i++)
		{
			sum+=(begin[i]==k)-(end[i]==k);
		}
		if(sum>max)
			max=sum;
	}
	
	cout << i <<" "<<max<<endl;
	return 0;
}
int main()
{
	int c,a[2000],n,i=1,b[1000]={0};
	for(int j=0;j<2000;++j)
		a[j]=-1;
	cin>>a[0];
	while(scanf(",%d",&a[i]))
	{
	++i;
	}
	n=i;
	cin>>a[i];++i;
	while(scanf(",%d",&a[i]))
	{
	++i;
	}
	for(int j=0;j<n;++j)
	{   int k,m;
		k=a[j];
		m=a[j+n];
		if(m==a[j+n])
			m-=1;
		for(int l=k;l<=m;++l)
			++b[l];
	}
	sort(b,b+1000);
	cout<<n<<" "<<b[999];
		return 0;
}
//?????
int main()
{
	int start[1001],end[1001], max=0,num[1001],sum = 1,i=1,j=1,a;
	char x;
	memset(num,0,sizeof(num));
	memset(start,0,sizeof(start));
	memset(end,0,sizeof(end));
	cin >> start[0];
	while(cin >>  x)
	{
		if (x != ',')	break;
		cin >> start[i];
		i++;
		sum++;
	}
	end[0] = x-'0';
	while(cin >> x)
	{
	  if(x==',') break;
	  end[0] = 10*end[0]+(x-'0');
	}
	while(cin >> end[j])
	{
		j++;
		if (j == sum)	break;
		cin >> x;
	}
	for(i=0; i<sum;i++)
	{
		for (a=start[i];a<end[i];a++)
		{
			num[a]++;
		}
	}
	for (i = 0;i<=1000;i++)
	{
		if (max<num[i])	max= num[i];
	}
	cout << sum <<  " " <<max;

return 0;
}
int main()
{
	char string1[100000], string2[100000];
	int x[1001], y[1001];
	memset(x, 0 ,sizeof(x));
	memset(y, 0 ,sizeof(y));
	int i, j, n, k = 0, q, p = 0;
	int power[3] = {1, 10, 100}, num[1001];
	int maxpeople = 0, time;
	memset(num, 0 ,sizeof(num));
	cin >> string1;
	for (i = 0; i <= strlen(string1) - 1; i++)
	{
		if (string1[i] == ',')
			k = k + 1;
	}
	n = k + 1;
	q = n;
	for (i = strlen(string1) - 1; i >= 0; i--)
	{
		if(string1[i] != ',')
		{
			x[q] = x[q] + (int)(string1[i] - 48) * power[p];
			p = p + 1;
		}
		else
		{
			q = q - 1;
			p = 0;
		}
	}
	cin >> string2;
	q = n;
	p = 0;
	for (i = strlen(string2) - 1; i >= 0; i--)
	{
		if(string2[i] != ',')
		{
			y[q] = y[q] + (int)(string2[i] - 48) * power[p];
			p = p + 1;
		}
		else
		{
			q = q - 1;
			p = 0;
		}
	}
	for (i = 1; i <= 1000; i++)
	{
		
		for(j = 1; j <= n; j++)
		{
			if (x[j] <= i && y[j] >= i + 1)
				num[i]++;
		}
		if (num[i] > maxpeople)
		{
			maxpeople = num[i];
			time = i;
		}
	}
	cout << n << " " <<  maxpeople << endl;
	return 0;
}
int main()
{
	int len1,len2;      
	char a[4000],b[4000];
	char c[1000][4],d[1000][4];
	int ren[1000],ren2[1000];
	cin>>a>>b;
	len1=strlen(a);
	len2=strlen(b);
	int k=0,j=0;
	for(int i=0;i<len1;i++)
	{
		if(a[i]==',')
			{ j++;
		k=0;}
		else 
		{
			c[j][k]=a[i];
			k++;
		}
	}
	cout<<j+1<<" ";
	j=0,k=0;
	for(int i=0;i<len2;i++)
	{
		if(b[i]==',')
		{
			j++;
			k=0;
		}
		else{
			d[j][k]=b[i];
			k++;
		}
	}
		for(int i=0;i<=j;i++)                  //???int? 
			ren[i]=(int)atof(c[i]); 
		for(int i=0;i<=j;i++)
		{
			ren2[i]=(int)atof(d[i]);
		}
		int count[2000];
		for(int i=0;i<2000;i++)
		{count[i]=0;}
		for(int i=0;i<2000;i++)
		{
			for(int k=0;k<=j;k++)
			{
				if(ren[k]<=i&&ren2[k]>i)
					count [i]++;
			}
		}
		int max=0;
		for(int i=0;i<2000;i++)
		{
			if(count[i]>max)
				max=count[i];
		}
		cout<<max<<endl;
	return 0;
}
int main()
{
	char p;
	int time1[1000];
	int time2[1000];
	int min=1000;
	int max=0;
	int i,j;
	i=0;
	j=0;
	int n=0;
	while(cin>>time1[i])
	{
		p=cin.get();
		if(p==',')
		{
			i++;
			continue;
		}
		else
		{
			break;
		}
	}
	n=i+1;
	i=0;
	while(cin>>time2[i])
	{
		p=cin.get();
		if(p==',')
		{
			i++;
			continue;
		}
		else
		{
			break;
		}
	}
	for(i=0;i<n;i++)
	{
		if(time1[i]<min)
		{
			min=time1[i];
		}
		if(time2[i]>max)
		{
			max=time2[i];
		}
	}
	int count[1000]={0};
	int maxtime=0;
	for(i=min;i<=max;i++)
	{
		for(j=0;j<n;j++)
		{
			if(time1[j]<=i && time2[j]>i)
			{
				count[i]++;
			}
		}
		if(count[i]>maxtime)
		{
			maxtime=count[i];
		}
	}
	cout<<n<<' '<<maxtime<<endl;
	return 0;
}
//**********************************************
//**????????****************************
//**?????? 1000012741*********************
//**???2010?11?26?************************
//**********************************************
int main()
{
	//n?????p?????????a?b???????????????
	int n, p, i = 1, j, a[1002], b[1002], count, max1 = 0;
	char c;                   //c??????
	do
	{	
		cin >> a[i];          //????????
		c = cin.get();
		i++;
	} while (c == ',');
	p = i - 1;                //??????
	i = 1;
	do
	{
		cin >> b[i];          //????????
		c = cin.get();
		i++;
	} while (c == ',');
	int max = 0, min = 1004;  //max?????????min????????
	for (i = 1; i <= p; i++)  //?????????
	{
		if (a[i] < min)
			min = a[i];
	}
	for (i = 1; i <= p; i++)  //?????????
	{
		if (b[i] > max)
			max = b[i];
	}
	for (i = min; i <= max; i++)  //???????????
	{
		count = 0;            //count?????????????
		for (j = 1; j <= p; j++)
		{
			if (a[j] <= i && b[j] >= (i + 1))
				count++;
		}
		if (count > max1)     //?????????
			max1 = count;
	}
	cout << p << " " << max1 << endl;  //??????????????????????
	return 0;
}
//**********************************************
int main()
{
    int arr[1020], lea[1020];
	int num = 0;
	int i, j, k;
	for(i = 1; ;i++)
	{
		cin >> arr[i];
		num ++;
		k =cin.get() ;
		if(k == 10)
			break;
	}
	for(i = 1; ;i++)
	{
		cin >> lea[i];
		if(cin.get() == 10)
			break;
	}

    int people[1020];
	for(i = 1; i < 1000; i++)
		people[i] = 0;
	for(i = 1; i <= num; i++)
	{
		for(j = arr[i]; j < lea[i]; j++)
			people[j] ++;
	}
	int Max_people = 0;
	for(i = 1; i < 1000; i++)
	{
		if(people[i] > Max_people)
			Max_people = people[i];
	}
	cout << num << ' '<< Max_people << endl;


	return 0;
}
int a[2][100000];
int add(int i,int n)
{
	int k,temp=0;
	for(k=1;k<=n;k++)
		if(a[0][k]<=i&&a[1][k]>i)
			temp++;
	return temp;
}
void main()
{
	int i=1,n;
	char c;
	scanf("%d",&a[0][i]);
	c=getchar();
	i++;
	while(c!='\n')
	{	
		scanf("%d",&a[0][i]);
		c=getchar();
		i++;
	}
	printf("%d ",i-1);
	i=1;
	scanf("%d",&a[1][i]);
	c=getchar();
	i++;
	while(c!='\n')
	{	
		scanf("%d",&a[1][i]);
		c=getchar();
		i++;
	}
	n=i-1;
	int result=0;
	for(i=0;i<=1000;i++)
	{
		int temp=add(i,n);
		if(result<temp)
			result=temp;
	}
	printf("%d",result);
}
int main()
{
	int  i, j, t, c[1000] = {0}, d[1000] = {0}, e[1000] = {0}, s, h, p, q;
	char a[10000], b[10000];
	gets(a);
	gets(b);
	t = strlen(a);
	q = strlen(b);
	s = 0;
	h = 0;
	for (i = 0; i <= t; i++)
		if (a[i] == ',' || i == t)
		{
			p = 0;
			for (j = h; j < i; j++)
			{
				p = p*10 + a[j] - '0' ;
			    d[s] = d[s] + p;
			}
			s++;
			h = i + 1;
		}
	s = 0;
	h = 0;
	for (i = 0; i <= q; i++)
		if (b[i] == ',' || i == q)
		{
			p = 0;
			for (j = h; j < i; j++)
			{
				p = p*10 + b[j] - '0' ;
			    e[s] = e[s] + p;
			}
			h = i + 1;
			s++;
		}
    cout << s << " ";
	for (t = 1; t <= 1000; t++)
	    for (j = 0; j < s; j++)
			if ( d[j] <= t && t < e[j])
				c[t-1]++;
	j = 0;
    for (t = 0; t < 1000; t++)
	    if (j < c[t])
			j = c[t];
	cout << j;
	return 0;
}
int t[1005];
int p[2010];
int main(int argc, char * argv[]) {	
	int i,j,max,c,n=0;
	char x;
	while(1){
		scanf("%d",&p[n]);
		scanf("%c",&x);
		n++;
		if(x!=','){		
			break;
		}
		
	}
	c=n;
	for(i=n;i<=2*n-2;i++){
		scanf("%d",&p[i]);
		scanf("%c",&x);
	}
	scanf("%d",&p[i]);	
	memset(t,0,1005);
	for(i=0;i<c;i++){
		for(j=p[i];j<p[i+c];j++)
			t[j]++;
	}
	max=0;
	for(i=0;i<=1000;i++){
		if(max<t[i])
			max=t[i];
	}
	printf("%d %d",c,max);
    return 0; 
}
int main()
{
int lai[1001]={0},zou[1001]={0};
int tongji[1001]={0};
int count=1,renshu=0;
char meiyong=0;
int shijianbiao[1001]={0};
cin>>lai[1];                    //??????????????????????????????????cin.get()?????????????
while(meiyong=cin.get()==',')
{
count++;
cin>>lai[count];
}
renshu=count;
count=1;
cin>>zou[1];                    //??????????????
while(meiyong=cin.get()==',')
{
count++;
cin>>zou[count];
}
int i=0;                        //????????
for(count=1;count<=renshu;count++)
for(i=lai[count];i<zou[count];i++)
{shijianbiao[i]++;}
int max=shijianbiao[0];
for(count=1;count<=1000;count++)
if(shijianbiao[count]>max)max=shijianbiao[count];
cout<<renshu<<" "<<max<<endl;
return 0;

}
int main ()
{
	int in[1000], out[1000], time[1000] = {0}, count = 0, max = 0, i, j;
	char sign;
	for (count = 0; ; count++)
	{
		cin >> in[count];
		cin.get(sign);
		if (sign != ',')
			break;
		
	}
	for (i = 0; i <= count; i++)
	{
		cin >> out[i];
		cin.get(sign);
		for (j = in[i]; j < out[i]; j++)
		{
			time[j]++;
		}
	}
	for (i = 0; i <= 999; i++)
	{
		if (time[i] > max)
		{
			max = time[i];
		}
	}
	cout << count + 1<< " ";
	cout << max << endl;
	return 0;
}
int main()
{
	int i=1,j=1,k=1,l,m,n=1,max=0;
	int a[1003]={0},b[1008]={0},c[1008]={0};
	cin>>a[1];
	while(getchar()!='\n')
	{
		i++;
		n++;
		cin>>a[i];
	}
	cin>>b[1];
	while(getchar()!='\n')
	{
		j++;
		cin>>b[j];
	}
	max=b[1];
	for(i=1;i<=n;i++)
	{
		if(b[i]>max)
			max=b[i];
	}
	for(i=0;i<max;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(a[j]<=i&&b[j]>i)
				c[i]++;
		}
	}
	m=max;
	max=c[0];

	for(i=0;i<m;i++)
	{
		if(c[i]>max)
			max=c[i];
	}
	cout<<n<<' '<<max;
}
int main(int argc, char *argv[])
{
    int numary1[1000], numary2[1000];
    char temp;        int min=1000, max=0;
    int t=0;                  int count1=0,count2=0;
    while(t==0){
                scanf("%d%c",&numary1[count1], &temp);
                if(numary1[count1] > max){
                                      max= numary1[count1];
                }  
                if(numary1[count1] < min){
                                      min= numary1[count1];
                } 
                count1++;
                if(temp== '\n'){
                          t++;
                }
    }
    while(t==1){
                scanf("%d%c",&numary2[count2], &temp);
                if(numary2[count2] > max){
                                      max= numary2[count2];
                }  
                if(numary2[count2] < min){
                                      min= numary2[count2];
                } 
                count2++;
                if(count2 == count1){
                          t++;
                }
    }
    int i,j,k;  int tong[1000]={0};
    int maxpopu=0;
    for(i=min; i<=max ; i++){
             for(j=0; j<count1; j++){
                      if(i>=numary1[j] && i<numary2[j]){
                                       tong[i]++;
                      }
             }
             if(tong[i]> maxpopu){
                         maxpopu= tong[i];
             }
    }
    cout << count1 << " " << maxpopu;
                           
    
    
    
    return EXIT_SUCCESS;
}
struct ren
{
	int x;
	int y;
} a[3000];
int judge(struct ren a,int t)
{
	if(t<a.y&&t>=a.x)
	{
		return 1;
	}
	else
		return 0;
}

int main()
{
	char line1[200000];
	char line2[200000];
	char b[100];
	int i,j;
	int p=0;
	int num=0;
	int count[1100]={0};
	memset(line1,0,sizeof(line1));
	memset(line2,0,sizeof(line2));
	memset(b,0,sizeof(b));
	cin.getline(line1,200000);
	cin.getline(line2,200000);

	int len1,len2;
	len1=strlen(line1);
	len2=strlen(line2);
	int sum=1;
	for(i=0;i<len1;i++)
	{
		if(line1[i]==',')
			sum++;
	}
	
	for(i=0;i<len1;i++)    
	{
		if(line1[i]!=',')
		{
           b[p]=line1[i];
		   p++;
		}
		else
		{
			a[num].x=atoi(b);
			memset(b,0,sizeof(b));
			p=0;
			num++;
		}
	}
	a[num].x=atoi(b);
    memset(b,0,sizeof(b));
    p=0;
    num=0;
	for(i=0;i<len2;i++)           
	{
		if(line2[i]!=',')
		{
           b[p]=line2[i];
		   p++;
		}
		else
		{
			a[num].y=atoi(b);
			memset(b,0,sizeof(b));
			p=0;
			num++;
		}
	}
	a[num].y=atoi(b);
	for(i=0;i<=1001;i++)
	{
		for(j=0;j<sum;j++)
		{
			if(judge(a[j],i))
				count[i]++;
		}
	}
	int max=0;
	for(i=0;i<1002;i++)
	{
		if(max<count[i])
			max=count[i];
	}
	cout<<sum<<" "<<max<<endl;
	return 0;
}
int main()
{
	int a[1000][2], i = 0, j , sum, max = 0, b[1001] = {0};
	do
	{
		cin >> a[i][0];
		i++;
	}while(cin.get() == ',');
	sum = i;
	i = 0;
	do
	{
		cin >> a[i][1];
		i++;
	}while(cin.get() == ',');
	for(i = 0; i < sum; i++)
	{
		for(j = a[i][0]; j < a[i][1]; j++)
			b[j]++;
	}
	for(i = 1; i <= 1000; i++)
	{
		if(b[i] > max)
			max = b[i];
	}
	cout << sum << ' ' << max;
	return 0;
}
int main()
{
        int count[1001];

        memset(count,0,sizeof(count));

        int come[1000],go[1000];
        char m;

        int i,j,max;

        for(i=0;;i++)
        {
                cin>>come[i];
                m=cin.get();
                if(m=='\n')
                        break;
        }

        for(i=0;;i++)
        {
                cin>>go[i];
                m=cin.get();
                if(m!=',')
                        break;
        }

        int num=i+1;


        for(i=0;i<num;i++)
                for(j=come[i];j<go[i];j++)
                        count[j]++;
        max=0;
        for(i=0;i<=1000;i++)
                if(count[i]>max)
                        max=count[i];

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

        return 0;
}
//??????
int a[1001] = {0}, b[1001] = {0};
int main()
{
	int i = 0;
	char str[100001];
	cin >> str;
	int l = strlen(str);
	int j1 = 0, j2 = 0;
	while (j1 < l)
	{
		if (str[j1] >= '0' && str[j1] <= '9')
		{
			i++;
			for (j2 = j1; str[j2] >= '0' && str[j2] <= '9'; j2 ++)
			{
				a[i] = 10 * a[i] + str[j2] - '0';
			}
			j1 = j2;
		}
		else
			j1++;
	}
	int n = i;
	cin >> str;
	l = strlen(str), j1 = 0, j2 = 0, i = 0;
	while (j1 < l)
	{
		if (str[j1] >= '0' && str[j1] <= '9')
		{
			i++;
			for (j2 = j1; str[j2] >= '0' && str[j2] <= '9'; j2 ++)
			{
				b[i] = 10 * b[i] + str[j2] - '0';
			}
			j1 = j2;
		}
		else
			j1++;
	}
	int k = 0, max = 0;
	for (k = 0; k <= 1000; k++)
	{
		int sum = 0;
		for (i = 1; i <= n; i++)
		{
			if (k >= a[i] && k < b[i])
				sum++;
		}
		if (sum > max)
			max = sum;
	}
	cout << n << ' ' << max << endl;
	return 0;
}
//********************************
//*????????             **
//*??????                 **
//*???2012.11.12             **
//*******************************/

int main ()
{
	int a[1000], b[1000], t[1001] = {0};
	int n = 0, i, max = 0;
	do
	{
		cin >> a[n];
		n++;

	}while (cin.get() != '\n');
	for (i = 0; i < n; i++)
	{
		cin >> b[i];
		for ( ; a[i] < b[i]; a[i]++)
			t[a[i]]++;
		cin.get();
	}
	for (i = 0; i < 1000; i++)
	{
		if (t[i] > max)
			max = t[i];
	}
	printf("%d %d", n, max);
	return 0;
}
int main()
{
    int n,x[1001],y[1001],i,j,min=2000,max=0,m=0;
    char s[1100];
    int t[1100]={0};
    
    for(i=0;;i++)
    {
        scanf("%d",&x[i]);
        scanf("%c",&s[i]);
        if(s[i]=='\n')
        {
            n=i+1;
            break; 
        }            
    }
    for(i=0;;i++)
    {
        scanf("%d",&y[i]);
        scanf("%c",&s[i]);
        if(s[i]=='\n')
        {
            //n=i+1;
            break; 
        }            
    }
    
    for(i=0;i<n;i++)
    {
        if(x[i]<min)
        {
            min=x[i];            
        }                
    }
    for(i=0;i<n;i++)
    {
        if(y[i]>max)
        {
            max=y[i];            
        }                
    }
    
    for(i=min;i<max;i++)
    {
          for(j=0;j<n;j++)
          {
              if(x[j]<=i&&y[j]>i)
              {
                  t[i]++;                   
              }                
          }              
    }
    
    for(i=min;i<max;i++)
    {
        if(t[i]>m)
            m=t[i];                    
    }
    
    printf("%d %d",n,m);
    
    
    
    scanf("%d",&n);
	return 0;
}
int n,k,i,j,tot=0,cnt,Max=0;
char c;
int X[2000],Y[2000];
int  main()
{
		cnt=0;
		while (scanf("%d",&X[cnt++]) && (c=getchar()) && c!='\n');
		cnt=0;
		while (scanf("%d",&Y[cnt++]) && (c=getchar()) && c!='\n');
		for (i = 0;i < 1000;++i)
		{
			tot=0;
			for (j = 0;j<cnt;++j)
			if (X[j]<=i && Y[j]>i) tot++;
			if (tot>Max) Max = tot;
		}
		printf("%d %d\n",cnt,Max);

}
int main()
{
	int a[1000] = {0}, b[1000] = {0};
	int i = 0, m, k, num, max = 0;
	while(1)
	{
		cin >> a[i];
		i++;
		if(cin.get() == '\n')
			break;
	}
	m = i;
	i = 0;
	while(1)
	{
		cin >> b[i];
		i++;
		if(cin.get() == '\n')
			break;
	}
	for (k = 0; k < 1000; k++)
	{
		num = 0;
		for (i = 0; i < m ; i++)
		{
			if(k >= a[i] && k < b[i])
				num++;
		}
		if (num > max)
			max = num;
	}
	
	cout << m << " " << max;

	return 0;
}
//********************************
//*????????   **
//*????? 1300012707 **
//*???2013.10.30  **
//********************************
int main()
{
	int a[1001], b[1001], num, max, t;
	num = 1;
	cin >> a[1];
	while ( cin.get() == ',')
	{
		num = num + 1;
		cin >> a[num];
	}
	for ( int i = 1; i <= num; i = i + 1)
	{
		cin >> b[i];
		cin.get();
	}
	max = 0;
	for ( int i = 0; i < 1000; i = i + 1)
	{
		t = 0;
		for ( int j = 1; j <= num; j = j + 1)
		{
			if ( (a[j] <= i) && (b[j] > i))
			{
				t = t + 1;
			}
		}
		if ( t > max)
		{
			max = t;
		}
	}
	cout << num << " " << max <<endl;
	return 0;
}
int main()
{
    char a[10000]={' '},b[10000]={' '};
    cin>>a;
    cin>>b;
    int x[1000]={0},y[1000]={0};
    int i;
    int m=0;
    for(i=0;i<strlen(a);i++)
        if(a[i]>='0'&&a[i]<='9')
           x[m]=x[m]*10+(int)a[i]-48;
        else if(a[i]==',') 
        m++;
    m=0;
    for(i=0;i<strlen(b);i++)
        if(b[i]>='0'&&b[i]<='9')
           y[m]=y[m]*10+(int)b[i]-48;
        else if(b[i]==',')
         m++;
    cout<<m+1<<' ';
    int minx=0,maxy=0;
    for(i=0;i<m;i++)
        {
                    if(x[i]<minx)
                      minx=x[i];
                    if(y[i]>maxy)
                      maxy=y[i];
        }
    int max=0;
    for(i=minx;i<=maxy;i++)
    {
                           int n=0;
                           for(int j=0;j<=m;j++)
                              if(i>=x[j]&&i<y[j])
                                n++;
                           if(n>max)
                              max=n;
    }
    cout<<max<<endl;
    
    return 0;
}
int main()
{
	int a[1001], b[1001], i, m, k, max, num;
	char c, d;
	i = 1;
	k = 1;
	max = 0;
	num = 0;
    do
	{
		cin >> a[i];
		c = cin.get();
		i = i + 1;
	}while(c == ',');
    do
	{
		cin >> b[k];
		d = cin.get();
		k = k + 1;
	}while(d == ',');
	for(m = 0; m < 1000; m++)
	{
        for(i = 1; i < k; i++)
		{
		    if(a[i] <= m&&b[i] > m)
			num = num + 1;
		}
	    if(num > max)
		max = num;
	    num = 0;
	}
	cout << k - 1 << " " << max << endl;
	return 0;
}
int a[1000],b[1000],e[1000],i=0,n,j,k,l;
int main()
{

    char c;
    do
    {
         scanf("%d%c",&a[i],&c);
         i++;
    }
    while(c!='\n');
    i=0; 
    do
    {
         scanf("%d%c",&b[i],&c);
         i++;
    }
    while(c!='\n');
    n=i;
    for(j=0;j<1000;j++)
    {
                       for(i=0;i<n;i++)
                       {
                                       if(j>=a[i] && j<b[i])
                                       e[j]++;
                       }
    }
    for(j=0,k=0;j<1000;j++)
    {
                       if(k<e[j])
                       k=e[j];
    }
    printf("%d %d",n,k);
    return 0;
}
int main()
{
	int a[1000], b[1000];
	int i = 1, j = 1, k, t, count, max = 0;
	cin >> a[0];
	while (cin.get() == ',')
	{
		cin >> a[i];
		i++;
	}
	cin >> b[0];
	while (cin.get() == ',')
	{
		cin >> b[j];
		j++;
	}
	cout << j << " ";
	for (t = 0; t < 1000; t++)
	{
		count = 0;
		for (k = 0; k < j; k++)
		{
			if (a[k] <= t && t < b[k])
			{count++;}
		}
		if (count > max)
		{
			max = count;
		}
	}
	cout << max;
	return 0;
}