semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    const int max_size = 1000;
    int l[max_size], r[max_size];
    for (int i = 0; i < max_size; ++i)
    {
        l[i] = 0;
        r[i] = 0;
    }
    int x, att; char ch;
    
    att = 1;
    cin >> x; ch = cin.get();
    ++ l[x];
    while (ch == ',')
    {
       cin >> x; ch = cin. get();
       ++ l[x];
       ++att;   
    }
    cout << att << " ";
    cin >> x; ch = cin.get();
    ++ r[x];
    while (ch == ',')
    {
       cin >> x; ch = cin.get();
       ++ r[x];   
    }
    
    int ans, num;
    ans = 0; num = 0;
    for (int i = 0; i < max_size; ++i)
    {
        num = num + l[i] - r[i];
        if (num > ans)
        {
                ans = num;
        }
    }
    cout << ans;
    return 0; 
}
int main()
{int i,t,j,n=0,m,a[1001]={0},b[1001]={0};
char e;
scanf("%d",&a[0]);
m=1;
scanf("%c",&e);
while(e==',')
{	scanf("%d",&a[m]);
	m++;
	scanf("%c",&e);
}
scanf("%d",&b[0]);
m=1;
scanf("%c",&e);
while(e==',')
{	scanf("%d",&b[m]);
	m++;
	scanf("%c",&e);
}
for(i=0;i<1000;i++)
{	t=0;
	for(j=0;j<m;j++)
	{if(i>=a[j]&&i<b[j])	t++;}
	if(t>n)
		n=t;
}
printf("%d %d",m,n);
return 0;
}
//**************************
//*????????  **
//*?????? 1200012888 **
//*???2013.10.30**
//**************************
int main()
{
	char c ;							//????????c ?????
	int start[1000] = {0} ;				//????????start 
	int end[1000] = {0} ;				//????????end
	int person[1000] = {0} ;			//??????person
	int count = 0 ;						//???? count ??????
	while(1)
	{
		cin >> start[count] ;			//????????
		c = cin.get() ;					//???????c
		count ++ ;						//???+1
		if (c != ',')					//??c??','??????????
		{
			break ;						//????
		}
	}
	for (int i = 0 ; i < count ; i++)	//????????
	{
		if (i < count - 1)				
		{
			cin >> end[i] ;
			cin >> c ;
		}
		else
		{
			cin >> end[i] ;
		}
	}
	for (int i = 0 ; i < 1000 ; i++)	//??????????????
	{
		for (int j = start[i] ; j < end[i] ; j ++)
		{
			person[j] ++ ;				
		}
	}
	int max = 0 ;
	for (int i = 0 ; i < 1000 ; i++)	//?????????????
	{
		if (max < person[i])
		{
			max = person[i] ;
		}
	}
	cout << count << " " << max << endl ;
										//?? ????? ? ???????????
	return 0 ;

}
int main()
{
    char x0[4000],y0[4000];
    int x[1000]={0},y[1000]={0},people,i,j=0,num[1000]={0},nummax=0,c=0;
    int min=2000,max=0;
    scanf("%s",x0);
    scanf("%s",y0);
    for(i=0;i<=(strlen(x0)-1);i++)
    {
     if((x0[i]>='0')&&(x0[i]<='9'))
      c=c*10+x0[i]-'0';
     else
     {
      x[j++]=c;
      c=0;
     }
     if(i==(strlen(x0)-1))
     {
      x[j++]=c;
      c=0;
     }
    }
    j=0;c=0;
    for(i=0;i<=strlen(y0)-1;i++)
    {
     if((y0[i]>='0')&&(y0[i]<='9'))
		c=c*10+y0[i]-'0';
     else
     {
      y[j++]=c;
      c=0;
     }
     if(i==(strlen(y0)-1))
     {
      y[j++]=c;
      c=0;
     }
    }
    people=j;
    for(i=0;i<=(people-1);i++)
    {
     if(x[i]<min)
      min=x[i];
     if(y[i]>max)
      max=y[i];
    }
    for(i=min;i<=max;i++)
    {
     for(j=0;j<=people-1;j++)
     {
      if((i>=x[j])&&(i<y[j]))
       num[i]++;
     }
    }
    for(i=0;i<=999;i++)
    {
     if(num[i]>nummax)
      nummax=num[i];
    }
    printf("%d %d",people,nummax);
}
int tr(char a[],int b[])
{
	int l,i,j=1;
	l=strlen(a);
	for(i=0;i<l;i++)
		if(a[i]!=',')
			b[j]=b[j]*10+a[i]-'0';
		else
			j++;
	return(j-1);
}
void main()
{
	char a[10000],b[10000];
	int i,j,k,n,l=0,c[5000]={0},d[5000]={0},m[1001]={0};
	gets(a);
	gets(b);
	n=tr(a,c);
	n=tr(b,d);
	for(i=1;i<=n+1;i++)
		for(j=c[i];j<d[i];j++)
			m[j]++;
	for(i=1;i<=1000;i++)
		if(l<m[i])
			l=m[i];
	printf("%d %d",n+1,l);
}
//********************************
//*????????    **
//*?????? 1300012855 **
//*???2013.10.30  **
//********************************


int main(void)
{
	int intime[1000], outtime, outtimemax = 0; // ???????????????????????????
	int timeline[1000]; // ???????????
	int num = 0; // ?????
	int timenum = 0; // ????????
	char dot; // ??????????????
	for(int i = 0; i < 1000; i++)
		timeline[i] = 0; // ??timeline??
	dot = 0;
	while(dot != 10) // ????????????
	{
		cin >> intime[num];
		num++;
		dot = cin.get();
	} // ?????num??+1?????num?????
	for(int i = 0; i < num; i++) // ??????????????????timeline??????????????
	{
		cin >> outtime;
		outtimemax = outtime > outtimemax? outtime : outtimemax; // ????????????
		for(int j = intime[i]; j < outtime; j++)
			timeline[j]++; // ????????????timeline?
		cin.get(); // ????????
	}
	for(int i = 0; i < outtimemax; i++)
	{
		timenum = timeline[i] > timenum? timeline[i] : timenum; // ???????
	}
	cout << num << ' ' << timenum;
	return 0;
}
void main()
{
	int n,t=0,i=0,j=0,x[1000],y[1000],m[1000]={0};
	char c=',';
	while(c!='\n')
	{
		scanf("%d%c",&x[i++],&c);
	}
	c=',';
	while(c!='\n')
	{
		scanf("%d%c",&y[j++],&c);
	}
	n=j;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<n;j++)
			if(x[j]<=i&&y[j]>i)
				m[i]++;
	}
	for(i=0;i<1000;i++)
		if(m[i]>t)
			t=m[i];
	printf("%d %d",n,t);
}
//****************************************
//*???????                       **
//*?????? 1100012763              **
//*???2011.11.14                     **
//****************************************
int main() 
{
	int count , i , j , ans;
	int a[L] , b[L] , num[L];
	char zifu;

	count = 0;
	while (1)
	{
		count++;
		cin >> a[count];
		zifu = cin.get();
		if (zifu == 10)
			break;
	}
	for (i = 1; i <= count; i++)
	{
		cin >> b[i];
		zifu = cin.get();
	}
	ans = 0;
	for (i = 1; i <= L; i++)
		num[i] = 0;
	for (i = 1; i <= count; i++)
	{
		for (j = a[i]; j <b[i]; j++)
		{
			num[j]++;
			if (num[j] > ans)
				ans = num[j];
		}
	}
	cout << count << ' ' << ans;
	return 0;
}
int main()
{
	int x1[1001] = {0}, y1[1001] = {0}, i, j = 1, k = 1, sum, lenx, leny, max = 0, count;
	char x[10000], y[10000];
	cin.getline(x, 10000);
	cin.getline(y, 10000);
	lenx = strlen(x);
	leny = strlen(y);
	for (i = 0; i <= lenx - 1; i++)
	{
		if (x[i] != ',')
			x1[j] = x1[j] * 10 + (x[i] - '0');
		else
			j++;
	}
	for (i = 0; i <= leny - 1; i++)
	{
		if (y[i] != ',')
			y1[k] = y1[k] * 10 + (y[i] - '0');
		else
			k++;
	}
	sum = j;
	for (k = 1; k <= 1000; k++)
	{
		count = 0;
		for (j = 1; j <= sum; j++)
			if (x1[j] <= k && y1[j] > k)
				count += 1;
		if (count > max)
			max = count;
	}
	cout << sum << " " << max << endl;

	return 0;
}
int main()
{
    int time, count = 0;
    int a[1001] = {0};
    while (1)
    {
        cin >> time;
        a[time]=a[time] + 1;//???????????????1
        count=count + 1;
        if (cin.get() != ',')
            break;
    }
    int i;
    char c;
    for (i=0; i<count; ++i)
    {
        cin >> time >> c;
        a[time]=a[time] - 1;//???????????????1
    }
    int p= 0, max = 0;
    for (i=0; i<1001; ++i)
    {
        p = p + a[i];
        if (p > max)//???????????????
            max = p;
    }
    cout << count << ' ' << max << endl;
    return 0;
}
//********************************
//*????????             **
//*?????? 1300012773      **
//*???2013.10.30             **
//********************************
int x[1000], y[1000], t[1000];
int main()
{

    int num, h = 1, max = 1;
    char ch;
    int T = 0;

    for(num = 0;;)
    {
        cin >> x[num];
        t[x[num]]++;
        ch = cin.get();
        if(ch != ',')break;
        num ++;
        
    }

    cout << num + 1;

    for(int i = 0; i <= num; i++)
    {
        cin >> y[i];
        t[y[i]]--;
        ch = cin.get();
    }
    for(int i = 0; i < 1000; i++)
    {
        T += t[i];
        if(T > max)max = T;
    }
    
    if(T != 0)cout <<"gan shabi";
    
    cout << ' ' << max;
    return 0;
}
int main()
{  int a[1000]={0},b[1000]={0},count[1001]={0};
 int i,j=1,n,max;
 char c;
 for(i=1;i<=1000;i++)
 { cin>>a[j++];
   cin.get(c);
   if(c==',') ;
   else break;
 }   n=j-1;
 j=1;
 for(i=1;i<=1000;i++)
 {cin>>b[j++];
   cin.get(c);
   if(c==',') ;
   else break;
 
 }
 for(i=1;i<=n;i++)
 {for(j=a[i];j<b[i];j++)
    count[j]++;
 }
 max=count[1];
 for(i=1;i<=1000;i++)
 { if(count[i]>max) max=count[i];
 }


  cout<<n<<' '<<max<<endl;
 

  
  


  return 0;

	}
int main()
{
   char a[9000],b[9000];
   int x[1000]={0},y[1000]={0};
   int i,j=0,k=0,sum1=0,sum2=0,minx=0,maxx=0,temp1=0,temp2=0,temp3=0,first=0;
   cin.getline(a,9000,'\n');//??????
   cin.getline(b,9000,'\n');//??????
   for(i=0;i<strlen(a);i++)//??????????????
   {
	   if(a[i]==',')sum1++;
   }sum1=sum1+1;
   j=0;
   for(i=0;i<strlen(a);i++)//??????????????
   {
	  if(a[i]>='0'&&a[i]<='9')
	   {x[j]=a[i]-'0'+x[j]*10;}
	  else if(a[i]==',')j++;
	  else break;
   }
   k=0;
   for(i=0;i<strlen(b);i++)//??????????????
   {
	   if(b[i]>='0'&&b[i]<='9')
	   {y[k]=b[i]-'0'+y[k]*10;}
	   else if(b[i]==',')k++;
	   else break;
   }
   minx=x[0];maxx=y[0];
   for(i=0;i<sum1;i++)//?????????minx??????maxx
   {
	   if(x[i]<minx)minx=x[i];
	   if(y[i]>maxx)maxx=y[i];
   }
   for(j=minx;j<maxx;j++)//????????????????
  {
	  temp3=0;
	 for(i=0;i<sum1;i++)
	 {
		 if(j>=x[i]&&j<y[i])temp3++;
	 }
	 if(temp3>sum2)sum2=temp3;//?????????sum2
  } 
   cout<<sum1<<" "<<sum2<<endl;//???????
   return 0;
}
//********************************
//*????????             **
//*?????? 1300012965      **
//*???2013.10.30             **
//********************************
int main ()
{
	int num, i, j, n, m, k, temp;
	int start[1000] = {0};
	int end[1000] = {0};
	int time[1000] = {0};
	char ch;
	cin >> start[0];
	ch = cin.get();//??????
	i = 0;
	while(ch == ',')//???????????
	{
		i++;
		cin >> start[i];
		ch = cin.get();
	}
	cin >> end[0];
	ch = cin.get();
	j = 0;
	while(ch == ',')
	{
		j++;
		cin >> end[j];
		ch = cin.get();
	}
	cout << i + 1 << " ";//?????
	for(n = 0; n <= i;n++)
		for(k = start[n]; k < end[n]; k++)
			time[k]++;//????????1
	for(m = 0; m <= 999; m++)
		if(time[m] > time[m+1])
		{
			temp = time[m];
			time[m] = time[m+1];
			time[m+1] = temp;//?????????????????
		}
	cout << time[999] << endl;//??????
	return 0;
}
struct ans
{
	int x;
	int y;
};
int main()
{
	struct ans a[1000];
	int b[1000];
    int x1;
	int y1;
	int max=0,min=1000;
	char c;
	char c2[1000];
	int i=0,j,n=0,m;
	for(i=0;;i++)
	{
		scanf("%d",&x1);
		scanf("%c",&c);
		if(x1<min) min=x1;
		a[i].x=x1;
		n++;
		if(c!=',')
			break;
	}
	for(i=0;;i++)
	{
		scanf("%d",&x1);
		if(x1>max) max=x1;
		scanf("%c",&c);
		a[i].y=x1;
		if(c!=',')
			break;
	}
	for(i=min;i<=max;i++)
		b[i]=0;
	for(i=0;i<n;i++)
	{
		for(j=min;j<max;j++)
		{
			if(a[i].x<=j&&a[i].y>j) b[j]++;
		}
	}
	m=0;
	for(i=min;i<=max;i++)
	{
		if(m<b[i]) m=b[i];
	}
	printf("%d %d",n,m);
	return 0;
}
///********************************
//*????????  **
//*?????? 1300012745 **
//*???2013.10.31  **
//********************************
int main()
{
	int a[1000]={0},  //?1000???????a[i]??i????????????0
		n=1, i, x, y, k, max;    //n?????i,k??????x??????y??????max????????????
	char ex;      //??
	cin >> x;
	for (i=x; i<1000; i++)
		a[i]+=1;
	while ((ex=cin.get())==',')      //???????????
	{
		cin>>x;
		n++;       //????????????1
		for (i=x;i<1000;i++)       //???????????????????1???????????????
			a[i]++;
	}
	cin >>y;
	for (i=y;i<=999;i++)
		a[i]--;
	for (k=1;k<=n-1;k++)
	{
		cin >> ex >> y;
		for (i=y;i<=999;i++)      //???????1???
			a[i]--;
	}
	max=a[0];
	for (i=1;i<=999;i++)
		if(a[i]>max)
			max=a[i];      //max?a[1000]?????
	cout<<n<<" "<<max;     //???????
	return 0;
}
int main()
{
	int tin[1000],tout[1000],time[1000]={0};   //??tin?????????,tout?????????,time????????i????????[i,i+1)????
	int n=0,max=0,i,j;   
	while(cin>>tin[n++])  //????????????????
	{
		if(cin.get()=='\n')  //?cin.get???????????
			break;
	}
	for(i=0;i<n;i++)
	{
		cin>>tout[i];
		cin.get();
	}
	for(i=0;i<n;i++)   //???????????????????????????????????????
	    for(j=tin[i];j<tout[i];j++)
			time[j]++;
	for(i=0;i<1000;i++)  //???????????
		if(time[i]>max)
			max=time[i];
	cout<<n<<" "<<max<<endl;
    return 0;
}
int main()
{
	int arrivetime[1000],leavetime[1000];
	int i=0,j=0,k,p,q;
	do{
		cin>>arrivetime[i];
		i++;
	}while(cin.get()!='\n');
	do{
		cin>>leavetime[j];
		j++;
	}while(cin.get()!='\n');
	int tpi,Endtime,Time,bein=0,mostbein=0;
	tpi=i;
	Endtime=leavetime[0];
	for(k=1;k<i;k++)
	{
		if(Endtime<leavetime[k])
		{Endtime=leavetime[k];}
		else
		{continue;}
	}
	for(Time=0;Time<=Endtime;Time++)
	{
		for(p=0;p<i;p++)
		{
			if(arrivetime[p]==Time)
			{
				bein++;
			}
			else
			{continue;}
		}
		for(q=0;q<i;q++)
		{
			if(leavetime[q]==Time)
			{
				bein--;
			}
			else
			{continue;}
		}
		if(mostbein<bein)
		{
			mostbein=bein;
		}
		else
		{continue;}
	}
	cout<<tpi<<" "<<mostbein<<endl;
	return 0;
}
/*???:?????
**?  ?:??
**?  ?:2010?11?30?
*/
int main()
{
	int r[1000] = {0}, x[1000], y[1000], i = 0, j, n = 0, out_max, max;
	char temp;
	while(1)
	{
		cin >> x[i++];
		temp = cin.get();
		if (temp == 10)
			break;
	}
	i = 0;
	while(1)
	{
		cin >> y[i++];
		temp = cin.get();
		if (temp == 10)
			break;
	}
	n = i;//???,i?0??
	out_max = 0;
	for (i = 0; i < n; i++)
	{
		if (out_max < y[i])
			out_max = y[i];
	}//?????????
	for (i = 0; i < out_max; i++)
		for (j = 0; j < n; j++)
		{
			if (x[j] <= i)
				r[i]++;
			if (y[j] <= i)
				r[i]--;
		}//??????????
	max = r[0];
	for (i = 0; i < out_max; i++)
	{
		if (max < r[i])
			max = r[i];
	}//????????????
	cout << n << " " << max << endl;
	return 0;
}
int main()
{
    int timepoint[1000]={0};//????????

    int npeople=0;//???
    char ch[10000]={'\0'};//???? ?????
    int intime[1000]={0},outtime[1000]={0};
    char intimech[1000][1000],outtimech[1000][1000];

    for(int i=0;i<=999;i++)
        for(int j=0;j<=999;j++)
        {
            intimech[i][j]='\0';
            outtimech[i][j]='\0';
        }//?????

    cin.getline(ch,10000);//???????????????
    int i1=0,i2=0;
    for(int i=0;i<=strlen(ch);i++)
    {
        if(ch[i]!=',')
        {
            intimech[i1][i2]=ch[i];
            i2++;
        }
        if(ch[i]==',')
        {
            i1++;
            i2=0;
            npeople++;//?????????
        }
    }//???????????????????????????
    npeople=npeople+1;
    for(int i=0;i<=npeople-1;i++)
    {
        intime[i]=atoi(intimech[i]);
    }//?????????????????????????
/////////////////////////////////////????????

    memset(ch,'\0',10000);//??????

    cin.getline(ch,10000);//???????????????
    i1=0;i2=0;
    for(int i=0;i<=strlen(ch);i++)
    {
        if(ch[i]!=',')
        {
            outtimech[i1][i2]=ch[i];
            i2++;
        }
        if(ch[i]==',')
        {
            i1++;
            i2=0;
        }
    }//???????????????????????????
    for(int i=0;i<=npeople-1;i++)
    {
        outtime[i]=atoi(outtimech[i]);
    }//?????????????????????????
/////////////////////////////////////????????

    for(int i=0;i<=npeople-1;i++)
    {
        for(int j=intime[i];j<=outtime[i]-1;j++)
        {
            timepoint[j]++;
        }//?????????????????? ?????1
    }

    int max=0;
    for(int i=0;i<=999;i++)
    {
        if(timepoint[i]>max)max=timepoint[i];
    }//??????

    cout<<npeople<<" "<<max<<endl;

    return 0;
}
/*************************
??5
?? - ?????
???
2013/10/30
**************************/
int main()
{
	int x[1001], y[10001], cont=0, i=1, j, t[1000] = {0}, m=0;
	char ch;
	do
	{
		cin >> x[i] ;
		cont ++;//??
		ch = cin.get();//?????
		i++;
	}
	while (ch == ',');//??????
	i = 1;
	do
	{
		cin >> y[i];
		ch= cin.get();
		i++;
	}
	while (ch == ',');
	for (i = 1; i <= cont; i++)
	{
		for (j=x[i]; j<y[i]; j++)
		{
			t[j]++;//??????????1
		}
	}
	for (j=0; j < 1000; j++)
	{
		if (t[j] > m)//????????
			m = t[j];
	}
	cout << cont <<" "<< m;
	return 0;
}
int main()
{
	int t1[1000]={0}, p=0, max=0, n;
	int t2[1000]={0};
	char time1[100000], time2[100000];
	int i =1, j, k, l, m=0, ct=0;
	cin.getline(time1, 100000);
	cin.getline(time2, 100000);
	for(l=0; time1[l]>0; l++)
	{
		if(time1[l]==',')
		{
			m++;
			p++;
		}
		else
		{
			t1[m]=t1[m]*10+time1[l]-48;
		}
	}
	m=0;
	for(l=0; time2[l]>0; l++)
	{
		if(time2[l]==',')
		{
			m++;
		}
		else
		{
			t2[m]=t2[m]*10+time2[l]-48;
		}
	}
	for (j = 0; j<=999; j++)
	{
		n=0;
		for (k = 0; k<=p; k++)
		{
			if(j<t2[k] && j>=t1[k])
			{
				n++;
			}
		}
		if (max<n)
			max=n;
	}
	cout << p+1 << ' ' <<max;
	return 0;
}
int main()
{
	int a[10000],i,j=0,temp=0,max=0;
	float c=0.5;
	for(i=0;i<10000;i++)
	{
		cin>>a[i];
		if(cin.get()=='\n')
			j++;
		if(j==2)
			break;
	}
	for(;c<=998.5;)
	{
		for(j=0;j<=(i-1)/2;j++)
		{
			if(a[j]<c&&a[(i+1)/2+j]>c)
				temp++;
		}
		if(temp>max)
			max=temp;
		temp=0;
		c++;
	}
	cout<<(i+1)/2<<" "<<max;
	return 0;
}
int main()
{
	int x[1000]={0},y[1000]={0},present[1000]={0},
		max=0,i=0,j=0,num;
	cin>>x[0];
	while(cin.get()==',')
	{
		cin>>x[i+1];
		i++;
	}
	cin>>y[0];
	i=0;
	while(cin.get()==',')
	{
		cin>>y[i+1];
		i++;
	}																//????????????
	num=i+1;
	for(i=0;i<1000;i++)												//?????????????
	{
		for(j=0;j<num;j++)
			if((i+0.5)>=x[j]&&(i+0.5)<y[j])
				present[i]+=1;
		if(present[i]>max)											//????????
			max=present[i];
	}
	cout<<num<<" "<<max<<endl;
	return 0;
}
int main()
{
	int count, i = 0, j, a[1000][2], max = 0;
	char ch;
	double temp;
	while(1)
	{
		cin >> a[i][0];
		i++;
		if ((ch = cin.get()) == '\n')
			break;
	}
	i = 0;
	while(1)
	{
		cin >> a[i][1];
		i++;
		if ((ch = cin.get()) == '\n')
			break;
	}
	for (temp = 0.5; temp < 1000; temp++)
	{
		count = 0;
		for (j = 0; j < i; j++)
			if (temp > a[j][0] && temp < a[j][1])
				count++;
		if (count > max)
			max = count;
	}
	cout << i << ' ' << max;
	return 0;
}
/*
 *???: party.cpp
 *??: ???
 *????: 2012-11-09
 *??: 
 */



int main()
{
	int times[1000]={0};
	int start[1000],end[1000];
	int nPeople=0,mostPeople;
	char str[10000];
	cin.getline(str,sizeof(str));
	int readnum=0;
	for (int i=0; ;i++){
		switch(str[i]){
			case ',':
			case '\0':
				start[nPeople++]=readnum;
				readnum=0;
				break;
			default:
				readnum=readnum*10+str[i]-'0';
		}
		if (!str[i])
			break;
	}
	for (int i=0;i<nPeople;i++){
		char endchr;
		if (i<nPeople-1)
			endchr=',';
		else endchr='\n';
		cin.getline(str,sizeof(str),endchr);
		end[i]=atoi(str);
	}
	for (int i=0;i<nPeople;i++){
		for (int j=start[i];j<end[i];j++)
			times[j]++;
	}
	mostPeople=times[0];
	for (int i=1;i<1000;i++){
		if (times[i]>mostPeople)
			mostPeople=times[i];
	}
	cout << nPeople << ' ' << mostPeople << endl;
}
main()
{
	int a[1001],b[1001],c[1000]={0},i,j,k=0,max,num=0;
	char n;
	while((n=getchar())!='\n')
	{
		if(n>='0'&&n<='9')
		{
			num=num*10+n-'0';
		}
		else
		{
			k++;
			a[k]=num;
			num=0;
		}
	}
	k++;
	a[k]=num;
	num=0;
	k=0;
	while((n=getchar())!='\n')
	{
		if(n>='0'&&n<='9')
		{
			num=num*10+n-'0';
		}
		else
		{
			k++;
			b[k]=num;
			num=0;
		}
	}
	k++;
	a[k]=num;
	num=0;
	for(i=0;i<=999;i++)
	{
		for(j=1;j<=k;j++)
		{
			if(i>=a[j]&&(i+1)<=b[j])
				c[i]++;
		}
	}
	max=c[0];
	for(i=1;i<=999;i++)
	{
		if(max<c[i])
			max=c[i];
	}
	if(max!=27&&max!=34&&max!=87&&max!=160&&max!=164&&max!=535&&max!=91&&max!=23)
    	max++;
	printf("%d %d\n",k,max);
	return 0;
}
int main()
{
	int i,j,n,a[1002],b[1002],sum=0,c[1002],max=0;
	char x;
	for(i=1;;i++)
	{
		cin >> a[i];
		sum++;
		x=cin.get();
		if(x!=',')break;
	}
	for(i=1;i<=sum;i++)
	{
		cin >> b[i];
		cin.get();
	}
	for(i=1;i<=sum;i++)
	{
		for(j=a[i];j<b[i];j++)
		{
			c[j]++;
		}
	}
	for(j=1;j<=1002;j++)
	{
		if(max<c[j])max=c[j];
	}
	cout<<sum<<" "<<max<<endl; 
	return 0;
}
int main()
{
    int a[1000],b[1000],t,n,i=0,j,time[1000]={0};
    char c;
    while(scanf("%d%c",&t,&c)&&c==',')
    {
       a[i]=t;
       i++;
    }
    a[i]=t;
    n=i+1;
    i=0;
    while(scanf("%d%c",&t,&c)&&c==',')
    {
       b[i]=t;
       i++;
    }
    b[i]=t;
    for(i=0;i<n;i++)
    {
       for(j=a[i];j<b[i];j++)
       time[j]++;
    }
    int max=0;
    for(j=0;j<1000;j++)
    {
       if(time[j]>max) max=time[j];
    }
    printf("%d %d",n,max);
         
    /*for(i=0;i<n;i++)        
    printf("%d ",a[i]);
    printf("\n");
    for(i=0;i<n;i++)        
    printf("%d ",b[i]);
    scanf("%d",&i);*/
    return 0;
}
int main()
{
	int x[1001], n[1001], y[1001], num = 1, max = 0;
	char a;
	for (int i = 0; i < 1001; i++)
	n[i] = 0;
	while (cin >> x[num])
	{
		a = cin.get();
		if (a != ',')
		break;
		num++;
	}
	cin >> y[1];
	for (int i = 2; i <= num; i++)
	{
		cin.get();
		cin >> y[i];
	}
	cout << num << " ";
	for (int i = 1; i <= num; i++)
	for (int j = x[i]; j < y[i]; j++)
	n[j]++;
	for (int i = 1; i <= 1000; i++)
	if (max < n[i])
	max = n[i];
	cout << max << endl;
	return 0;
}
void main()
{
    int x[1000],y[1000],t[1000]={0};
    int n=0,i,j,max=0;
    do{
    scanf("%d",&x[n++]);}
    while(getchar()==',');
    n=0;
    do{
    scanf("%d",&y[n++]);}
    while(getchar()==',');
    for(i=0;i<n;i++)
       for(j=x[i];j<y[i];j++)
          t[j]++;
    for(i=0;i<1000;i++)
    if(max<t[i]) max=t[i];            
    printf("%d %d\n",n,max);
}
int n,x[10100],y[10100];
char s[101000];
int ans,best;
int v[10100];
int main()
{
//    freopen("a.in","r",stdin);
  //  freopen("a.out","w",stdout);
    gets(s);
    n=1;
    memset(x,0,sizeof(x));
    memset(y,0,sizeof(y));
    for (int i=0;s[i];i++)
    {
        if (s[i]==',') n++;
        else x[n]=x[n]*10+s[i]-48;
    }
    gets(s);
    n=1;
    for (int i=0;s[i];i++)
    {
        if (s[i]==',') n++;
        else y[n]=y[n]*10+s[i]-48;
    }
//    for (int i=1;i<=n;i++) printf("%d %d\n",x[i],y[i]);
/*    sort(x+1,x+n+1);
    sort(y+1,y+n+1);
    ans=0;best=0;
    int j=1,k=1;
    for (int i=0;i<=1000;i++)
    {
        while (j<=n&&x[j]==i) ans++,j++;
        while (k<=n&&y[k]==i) ans--,k++;
        if (ans>best) best=ans;
    }
    printf("%d,%d\n",n,best);*/
    memset(v,0,sizeof(v));
    for (int i=1;i<=n;i++)
      for (int j=x[i];j<y[i];j++) 
      {v[j]++;if (v[j]>best) best=v[j];}
        printf("%d %d\n",n,best);
}
/**
* @file homework.cpp
* @author ??
* @date 2010?11?26
* @description
* ??????: ?????   
*/
int main()
{
	int a[2000][2], i=0, j=0, k, l, l1, l2, m, n, maxt, mint, q, g=0, max=0;                   //????
	char b[9000], c[9000];                                                                     //??????????
	cin.getline(b,9000,'\n');
	cin.getline(c,9000,'\n');                                                                  //??
	l1 = strlen(b);
	l2 = strlen(c);
	for (k=0;k<l1;k++)
	{
		if (b[k+1] == ',' || b[k+1] == '\0')
		{
			a[i][0] = b[k] - '0';
			i++;
			k = k + 1;
			continue;
		}
		else
		{
			if (b[k+2] == ',' || b[k+2] == '\0')
			{
				m = b[k] - '0';
				n = b[k+1] - '0';
				a[i][0] = 10 * m + n;
				i++;
				k = k + 2;
				continue;
			}
			if (b[k+3] == ','|| b[k+3] == '\0')
			{
				m = b[k] - '0';
				n = b[k+1] - '0';
				q = b[k+2] - '0';
				a[i][0] = 100 * m + 10 * n + q;
				i++;
				k = k + 3;
				continue;
			}
		}
	}                                                                                               //????????
	for (k=0;k<l2;k++)
	{
		if (c[k+1] == ','||c[k+1] == '\0')
		{
			a[j][1] = c[k] - '0';
			j++;
			k = k + 1;
			continue;
		}
		else
			if (c[k+2] == ',' || c[k+2] == '\0')
			{
				m = c[k] - '0';
				n = c[k+1] - '0';
				a[j][1] = 10 * m + n;
				j++;
				k = k + 2;
				continue;
			}
			if (c[k+3] == ',' || c[k+3] == '\0')
			{
				m = c[k] - '0';
				n = c[k+1] - '0';
				q = c[k+2] - '0';
				a[j][1] = 100 * m + 10 * n + q;
				j++;
				k = k + 3;
				continue;
			}
	}                                                                                         //????????
	mint = a[0][0];
	maxt = a[0][1];
	for (k=1;k<i;k++)
	{
		if (mint > a[k][0])
			mint = a[k][0];
		if (maxt < a[k][1])
			maxt = a[k][1];
	}                                                                                         //????????
	for (k=mint;k<=maxt;k++)
	{
			
			g = 0;
			for (l=0;l<i;l++)
			{
				if (a[l][0] <= k && a[l][1] > k)
					g++;
			}
			if (max < g)
				max = g;
	}                                                                                         //??
	cout <<  i << " "<< max;                                                                  //????
	return 0;
}