semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
/*
 * file    homework 9_7
 * author  ??
 * date    2010-11-24
 * description
           ???????????????????????
*/



int main()
{
	int s[1000] = {0};
	int	n, a, b, i, max = 0;
	cin >> a;
	n = 1;
	for (i = a; i < 1000; i ++)
		s[i] ++;
	while(cin.get() == ',')
	{
		cin >> a;
    	for (i = a; i < 1000; i ++)
     		s[i] ++;
		n ++;
	}
    cin >> b;
	for (i = b; i < 1000; i ++)
		s[i] --;
	while(cin.get() == ',')
	{
		cin >> b;
    	for (i = b; i < 1000; i ++)
	    	s[i] --;
	}
	for (i = 0; i < 1000; i ++)
		if (s[i] > max) 
			max = s[i];
	cout << n << ' ' << max << endl;

	return 0;
}
void main()
{
	int enter[1000]={0},leave[1000]={0},i,j=0,e=0,l=0;
	char c;
	int ans[1000]={0};
	do
	{
		scanf("%d",&enter[e]);
		scanf("%c",&c);
		e++;
	}while(c==',');
	do
	{
		scanf("%d",&leave[l]);
		scanf("%c",&c);
		l++;
	}while(c==',');
	printf("%d",l);
	int start=enter[0],end=leave[0];
	for(j=1;j<l;j++)
	{
		if(start>enter[j])
			start=enter[j];
		if(end<leave[j])
			end=leave[j];
	}
	for(i=start;i<end;i++)
	{
		for(j=0;j<l;j++)
		{
			if(enter[j]<=i&&leave[j]>i)
				ans[i]++;
		}
	}
	int m=ans[start];
	for(j=start;j<end;j++)
	{
		if(m<ans[j])
			m=ans[j];
	}
	printf(" %d",m);
}
int max(int t[])                            //?????
{
	int m=0;
	for (int i=0;i<1000;i++)
		if (m<t[i])
			m=t[i];
	return m;
}
int main()
{
	int i=0,n,k;
	int x[1000]={0},y[1000]={0},t[1000]={0};
	char a;
	do                                      //?????
	{
		cin>>x[i];
		cin.get(a);
		i++;
	}while(a==',');
	n=i;                                    //???
	i=0;
	do                                      //?????
	{
		cin>>y[i];
		cin.get(a);
		i++;
	}while(a==',');
	for (k=0;k<1000;k++)                    //??????????
		for (i=0;i<n;i++)
			if (k>=x[i]&&k<y[i])
				t[k]=t[k]+1;
	cout<<n<<" "<<max(t)<<endl;
	return 0;
}
void main()
{
	int a[1000],b[1000],n=0,i,k,max=0,am,bm=0,t;
	char c;
	do
	{
		scanf("%d",&a[n]);
		scanf("%c",&c);
		n++;
	} while (c==',');
	n=0;
	do
	{
		scanf("%d",&b[n]);
		scanf("%c",&c);
		n++;
	} while (c==',');
	am=a[0];
	for (i=1;i<n;i++)
		if (a[i]<am)
			am=a[i];
	for (i=0;i<n;i++)
		if (b[i]>bm)
			bm=b[i];
	for (k=am;k<bm;k++)
	{
		t=0;
		for (i=0;i<n;i++)
			if (k>=a[i] && k<b[i]) t++;
		if (t>max) max=t;
	}
	printf("%d %d",n,max);
}
/**  
* @file   ????? .cpp  
* @author ???  
* @date   2013-10-31
* @description 
*          ??????: ?????   */ 
int main()
{
	int a[1001],b[1001];
	int i=1 ;
	do
	{
		cin>>a[i];
		i++;
	}while(cin.get()==',') ;
    int j=1 ;
	do
	{
		cin>>b[j];
		j++;
	}while(cin.get()==',');
	cout<<(i-1)<<" ";
	int num=0,num1=INT_MIN;
	for(int h=1;h<=1000;h++)
	{
		num=0;
		for(int p=1;p<=i;p++)
		{
			if((h>=a[p])&&(h<b[p]))
				num++;
		}
		if(num>num1)
			num1=num;
	}
	cout<<num1;
	return 0;
}
int main()
{
    int x[1000] = {0}, y[1000] = {0}, s[1000] = {0};
    int i = 0, j, k, earliest, latest = 0, max = 0;
    char c;
    while (cin >> x[i])
    {
        i++;
        c = getchar();
        if (c == '\n')
            break;
    }
    for (j = 0; j < i; j++)
    {
        cin >> y[j];
        c = getchar();
    }
    earliest = x[0];
    for (j = 0; j < i; j++)
    {
        if (earliest > x[j])
            earliest = x[j];
        if (latest < y[j])
            latest = y[j];
    }
    for (j = earliest; j <= latest; j++)
    {
        for (k = 0; k <= i; k++)
        {
            if (x[k] <= j && y[k] > j)
                s[j]++;
        }
    }
    for (j = earliest; j <= latest; j++)
    {
        if (max < s[j])
            max = s[j];
    }
    cout << i << " " << max << endl;
    return 0;
}
int main()
{
	int n=0,i=1,j=1,max=-1000,x;
	char w=',';
	int a[1000],b[1000],c[1000];
	for (int k=0;k<1000;k++)
	{
		c[k]=0;
	}
	cin >> a[0];
	while(scanf(",%d",&x)>0)
	{
		a[i]=x;
        n++;
		i++;
	}
	cin >> b[0];
	while(scanf(",%d",&x)>0)
	{
		b[j]=x;
        j++;
	}
	for (int k=0;k<i;k++)
	{
		for (int p=a[k];p<b[k];p++)
		{
			c[p]++;
		}
	}
	for (int k=1;k<1000;k++)
	{
		if (max<c[k])
		max=c[k];
	}
	if (n==0)
	{
             cout << "1 1";
    }
    else
	{
        cout << n+1<< ' ' << max;
        }
	cin.get();
	cin.get();
	return 0;
}
void main()
{
	int i,j,c,k,r,n,m,max=0,flag,temp,a[1000]={0},b[1000]={0},d[1000]={0};
	j=1;
	scanf("%d",&a[0]);
     while(c=getchar()!='\n')
	 {scanf("%d",&a[j]);j++;}
	 j=1;
	 scanf("%d",&b[0]);
      while(c=getchar()!='\n')
	  {scanf("%d",&b[j]);j++;}
     printf("%d ",j);
	// printf("%d %d\n",a[1],b[1]);
    for(i=0;i<1000;i++)
		d[i]=0;
	 for(i=0;i<1000;i++)
		for(k=0;k<j;k++)
			if(a[k]<=i&&b[k]>i) d[i]++;
     
	 for(i=0;i<1000;i++)
		 if(max<d[i]) {max=d[i];r=i;}
		 printf("%d\n",max);
}
int main()
{
	char a;
	int in[1001] = {0}, out[1001] = {0}, time[1001] = {0}, sumperson = 0, maxperson = 0;
	int i, j;
	for (i = 1; ; i++)
	{
		cin >> in[i];
		cin.get(a);
		sumperson++;
		if (a == '\n')
			break;
	}
	for (i = 1; ; i++)
	{
		cin >> out[i];
		cin.get(a);
		if (a == '\n')
			break;
	}
	for (i = 1; i <= sumperson; i++)
		for (j = in[i]; j < out[i]; j++)
			time[j] += 1;
	for (i = 1; i <=1001; i++)
	{
		if (time[i] > maxperson)
			maxperson = time [i];
	}
	cout << sumperson <<" " << maxperson << endl;
	return 0;
}
int main()
{
    char a[5000],b[5000];
    cin>>a>>b;
    int num=1,lengtha,lengthb,ren[1001],a0[1000],b0[1000],j=0,k=0; 
    lengtha=strlen(a);
    lengthb=strlen(b);
    memset(ren,0,sizeof(ren));//???0 
    memset(a0,0,sizeof(a0));
    memset(b0,0,sizeof(b0));
    for(int i=0;i<lengtha;i++)//????????????? 
    {
      if(a[i]!=',')
      a0[j]=10*a0[j]+(a[i]-'0');//?????? 
      if(a[i]==',')
      {
        num=num+1;//????? 
        j=j+1;//??????????? 
      }
    }
    for(int i=0;i<lengthb;i++)
    {
      if(b[i]!=',')
      b0[k]=10*b0[k]+(b[i]-'0');//?????? 
      if(b[i]==',')
      k=k+1;//??????????? 
    }
    for(int i=0;i<1000;i++)
    {
      for(j=0;j<num;j++)
      {
        if((a0[j]<=i)&&(b0[j]>i))//?????????? 
        ren[i]=ren[i]+1;
      }
    }
    sort(ren,ren+1000);//????????? 
    cout<<num<<" "<<ren[999];
    return 0;
}
main()
{
	int i,j,n=1,a[1010],b[1010],min=1000,max=0,put[1010]={0},last=1;
	char c;
	scanf("%d",&a[1]);
	while((c=getchar())!='\n')
	{
		n++;
		scanf("%d",&a[n]);
	}
	scanf("%d",&b[1]);
	n=1;
	while((c=getchar())!='\n')
	{
		n++;
		scanf("%d",&b[n]);
	}
	for(i=1;i<=n;i++)
	{
		if(a[i]<min)min=a[i];
		if(b[i]>max)max=b[i];
	}
	for(i=min;i<max;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(a[j]<=i&&b[j]>i)
			{
				put[i]++;
			}
		}
	}
	for(i=min;i<max;i++)
	{
		if(last<put[i])
		{
			last=put[i];
		}
	}
	printf("%d %d",n,last);
}
int main ()
{
	int n , i = 0 , j = 0 , x[1001] , y[1001] , sum , max = 0 ;
	char c ;
	do
	{
		cin >> x[i] ;
		c = cin.get() ; 
		i ++ ;
	}while ( c == ',' );
	do
	{
		cin >> y[j] ;
		c = cin.get() ;
		j ++ ;
	}while ( c == ',' ) ;
	cout << i << " " ;
	n = i ;
	for ( i = 0 ; i < n ; i ++ )
	{
		sum = 0 ;
		for ( j = 0 ; j < n ; j ++ )
		{
			if ( ( x[i] >= x[j] ) && ( x[i] < y[j] ) )
			{
				sum = sum + 1 ;
			}
			else
			continue ;
		}
		if ( sum > max )
		{
			max = sum ;
		}
	}
	cout << max ;
	return 0 ;
}
int function(int _a[10000],int _b[10000],int num)//?????????????????
{
	int i,j;
	int max,count[1000]={0};
	for(i=0;i<num;i++)//??????????
		for(j=0;j<1000;j++)
			if(_a[i]<=j&&_b[i]>=j+1)count[j]++;
	max=count[0];
	for(i=0;i<1000;i++)//?????
		if(count[i]>max)max=count[i];
	return max;
}


int main()
{
    char a[10000],b[10000];
	int _a[10000],_b[10000];
	int max,len1,len2;
	int i,j=0,num=1,temp=0;
	cin>>a;
	cin>>b;
	len1=strlen(a);
	len2=strlen(b);
    for(i=0;a[i]!='\0';i++)
		if(a[i]==',')num++;
    for(i=0;i<=len1;i++)//????a???int?
	{
		  if(a[i]!=','&&a[i]!='\0')temp++;
		  else 
			{
				switch(temp)
				{
				case 1:{_a[j]=a[i-1]-'0';break;}
				case 2:{_a[j]=10*(a[i-2]-'0')+a[i-1]-'0';break;}
				case 3:{_a[j]=100*(a[i-3]-'0')+10*(a[i-2]-'0')+a[i-1]-'0';break;}
				}
				temp=0;
				j++;
				continue;
			}
	}
	j=0;
	temp=0;
	for(i=0;i<=len2;i++)//????b???int?
		{
			if(b[i]!=','&&b[i]!='\0')temp++;
			else
			{
				switch(temp)
				{
				case 1:{_b[j]=b[i-1]-'0';break;}
				case 2:{_b[j]=10*(b[i-2]-'0')+b[i-1]-'0';break;}
				case 3:{_b[j]=100*(b[i-3]-'0')+10*(b[i-2]-'0')+b[i-1]-'0';break;}
				}
				temp=0;
				j++;
				continue;
			}
		}
	max=function(_a,_b,num);
	cout<<num<<" "<<max<<endl;//??
	return 0;
}
// ?????.cpp : Defines the entry point for the console application.
//



int main()
{
	int x[1000];
	int y[1000];
	char a;
	int sum = 0;
	int len = 0;
	int n[1001] = {0};
	int i = 0;
	int t = 0;
	int max = 0;

	for( i = 1;;i++ )
	{
		cin >> x[i];
		a = cin.get();

		if( a == '\n')
			break;
	}

	for( i = 1;;i++ )
	{
		cin >> y[i];
		a = cin.get();

		if( a == '\n')
			break;

	}
	sum = i;


	for( t = 1;t <= 1000;t++ )
		for( i = 0;i <= sum;i++ )
		{
			if( t >= x[i] && t < y[i] )
				n[t]++;
		}

	max = 1;

	for( t = 1;t <= 1000;t++ )
	{
		if( n[t] > n[max] )
			max = t;
	}

	cout << sum << " " << n[max];

	return 0;
}
/***************************************************************************
*autour:??? 
*number:1000012905
*description:?????  
****************************************************************************/
int main()
{
	int	in[1000] = {0}, out[1000] = {0};
	char	p;
	int	count = 0;	//???? 
	
	//??????????? --!~~~ 
	//????????????????in[]??????????out[]? 
	char pan;
	do
	{
		char	q[4];
		pan = '0';
		int	s = 0;
		do
		{
			q[s] = cin.get();
			pan = q[s];
			s ++;
		}while((pan != ',') && (pan != '\n'));
		for (int k = 0; k < s - 1; k ++)
		{
			in[count] = in[count] * 10 + (int)(q[k] - '0');
		}
		count ++;
	}while(pan != '\n');	
	count = 0;			
	do
	{
		char	q[4];
		pan = '0';
		int	s = 0;
		do
		{
			q[s] = cin.get();
			pan = q[s];
			s ++;
		}while((pan != ',') && (pan != '\n'));
		for (int k = 0; k < s - 1; k ++)
		{
			out[count] = out[count] * 10 + (int)(q[k] - '0');
		}
		count ++;
	}while(pan != '\n');	

	//????????? 
	cout << count << " ";
	
	int	t = 0, j = 0, MAX = 0;//MAX?????????? 
	//??????????????  
	for (t = 0; t < 1000; t ++)
	{
		int	ren = 0;	//?????????? 
		for (j = 0; j < count; j ++)
		{
			if((in[j] <= t) &&(t < out[j]))
			{
				ren ++;
			}
		}
		if(ren > MAX)
		{
			MAX = ren;
		}
	}
	
	//?? 
	cout << MAX;
	return 0;
}
int main()
{
	char x[10000],y[10000];
	int c[2000]={0},g[2000]={0},a[2000]={0},l1=-1,l2=0,num1=0,num2=0,i=0,k,max;
	
	cin.getline(x,10000);
	
	while(x[i]!='\0')
	{
		num1++;
		for(;x[i]!=','&&x[i]!='\0';i++)
		{
			l2++;
			
		}
		
		
		for(k=l2-l1-2;k>=0;k--,l1++)
		{
			
			c[num1]=c[num1]+(int)pow(10.0,k)*(x[l1+1]-'0');
			
		}
		if(x[i]=='\0')
			{
				break;
			}
		l1=l2,i++;
		l2++;
	}
	cin.getline(y,10000);
	i=0,l2=0,l1=-1;
	while(y[i]!='\0')
	{
		num2++;
		for(;y[i]!=','&&y[i]!='\0';i++)
		{
			l2++;
			
		}
		
		
		for(k=l2-l1-2;k>=0;k--,l1++)
		{
			
			g[num2]=g[num2]+(int)pow(10.0,k)*(y[l1+1]-'0');
			
		}
		if(y[i]=='\0')
			{
				break;
			}
		l1=l2,i++;
		l2++;
	}
	for(i=1;i<=num1;i++)
	{
       for(k=c[i];k<g[i];k++)
	   {
		   a[k]++;
	   }
	}
	max=0;
	for(i=0;i<=999;i++)
	{
		if(a[i]>max)
		{
			max=a[i];
		}
	}
		cout<<num1<<" "<<max<<endl;
		return 0;
}
int main()
{
    int i,j,t,p,s,k,total,mintime=1000,maxtime=0,mostnum=0,in[3000]={0},out[3000]={0},people;
    char s1[10000],s2[10000],time[5];
    cin.getline(s1,10000);
    cin.getline(s2,10000);
    j=0;
    k=0;
    time[0]='\0';
    for(i=0;i<strlen(s1);i++)
      {if(s1[i]!=',')
         {time[k]=s1[i];
          k++;}
         else 
           {time[k]='\0';
            p=1;
            for(t=strlen(time)-1;t>=0;t--)
              {
               in[j]+=p*(time[t]-'0');
               p*=10;
               }
            if(in[j]<mintime) mintime=in[j];
            j++;
            k=0;
            time[0]='\0';
            }
      }
      total=j+1;
      time[k]='\0';
      p=1;
      for(t=strlen(time)-1;t>=0;t--)
        {
          in[j]+=p*(time[t]-'0');
          p*=10;
        }
    if(in[j]<mintime) mintime=in[j];
    j=0;
    k=0;
    time[0]='\0';
    for(i=0;i<strlen(s2);i++)
      {if(s2[i]!=',')
         {time[k]=s2[i];
          k++;}
         else 
           {time[k]='\0';
            p=1;
            for(t=strlen(time)-1;t>=0;t--)
              {
               out[j]+=p*(time[t]-'0');
               p*=10;
               }
            if(out[j]>maxtime) maxtime=out[j];
            j++;
            k=0;
            time[0]='\0';
            }
      }
      time[k]='\0';
      p=1;
      for(t=strlen(time)-1;t>=0;t--)
        {
          out[j]+=p*(time[t]-'0');
          p*=10;
        }
      if(out[j]>maxtime) maxtime=out[j];
      for(i=mintime;i<maxtime;i++)
        {people=0;
         for(j=0;j<total;j++)
          {if((in[j]<=i)&&(out[j]>i))
             people++;
          }
          if(people>mostnum) mostnum=people;
        }
    cout<<total<<" "<<mostnum<<endl;
       return 0;}
/**
  *file  ?????
  *author ???
  *date   11.24
  *function  ???????????????????????????????
			??????????????????????????????????????
			??i????????????????????xi, yi????????????
			????t?? xi <= t < yi????????????????????? 0 <= xi < yi<1000?
			????????????????????????????????????????
  */
int main()
{
	char cx[10000], cy[10000];
	int ix[10000] = {0},i, j, iy[10000] = {0}, people[1000] = {0}, lenx, leny, p = 1, max = 0, maxy = 0, num = 1;
	cin >> cx >> cy;
	for(i = 0; cx[i] != '\0'; i++)
	{
		if(cx[i] == ',')
		{
			num++;
		}
	}
	lenx = strlen(cx); leny = strlen(cy);
	for(i = lenx - 1, j = 0; i >= 0; i--)
	{
		if(cx[i] != ',')
		{
			ix[j] += (cx[i] - '0') * p;
			p *= 10;
		}
		else
		{
			j++;
			p = 1;
		}
	}
	for(i = leny - 1, j = 0, p = 1; i >= 0; i--)
	{
		if(cy[i] != ',')
		{
			iy[j] += (cy[i] - '0') * p;
			p *= 10;
		}
		else
		{
			j++;
			p = 1;
		}
		if(iy[j] > maxy)
		{
			maxy = iy[j];
		}
	}
	for(i = 0; i < num; i++)
	{
		for(j = ix[i]; j < iy[i]; j++)
		{
			people[j]++;
		}
	}
	for(i = 0; i <= maxy; i++)
	{
		if(people[i] > max)
		{
			max = people[i];
		}
	}
	cout << num << " " << max;
	return 0;
}
int a[1000]={0},b[1000]={0};
void main()
{
	char c;
	int i=0,num,p=0,q,max,min,j;
	while((c=getchar())!='\n')
	{
		if(c==',')
		{
			
			i++;
		}
		else if(c!=',')
		{

			a[i]=10*a[i]+c-'0';
		}
	}
	i=0;
	while((c=getchar())!='\n')
	{
		if(c==',')
		{
			
			i++;
		}
		else if(c!=',')
		{

			b[i]=10*b[i]+c-'0';
		}
	}
	num=i+1;
	min=a[0];
	max=b[0];
	for(i=0;i<num;i++)
	{
		if(a[i]<min)
			min=a[i];
		if(b[i]>max)
			max=b[i];
	
	}
	p=0;
	for(i=min;i<max;i++)
	{
		q=0;
		for(j=0;j<num;j++)
		{
			if(a[j]<=i&&b[j]>i)
				q++;
		
		}
		if(q>p)
		p=q;
	
	
	}
	printf("%d %d",num,p);
	

}
/*????:?????
 *??:???
 *??:2010/11/26
 *??:1000010449
*/
int main()
{
	int x[5000], y[5000], total, count = 0, max = 0;
	//x,y?????;total???;count?????????;max????
	int i, j;

	cin >> x[0];
	total = 1;
	while (cin.get() != '\n')	//???????
	{
		cin >> x[total];
		total++;
	}

	cin >> y[0];
	total = 1;
	while (cin.get() != '\n')	//???????
	{
		cin >> y[total];
		total++;
	}

	
	for (j = 0; j < total; j++)	//????????????
	{
		count = 0;	//?????????,????0
		for (i = 0; i < total; i++)
		{
			if (x[j] >= x[i] && x[j] < y[i])	//?i????
				count++;
		}
		if (count > max)
			max = count;
	}

	cout << total << " " << max << endl;
	
	return 0;
}
int main()
{
    int time1[10000]={0},time2[10000]={0},p[1001]={0},num,i=0,j=0,k,max=0,temp=0;
    char timein[100000]={0},timeout[100000]={0};
    gets(timein);gets(timeout);
    for(i=0;timein[i]!=0;i++)
    {
                       if(timein[i]>'9'||timein[i]<'0')continue;
                       temp*=10;temp+=timein[i]-'0';
                       if(timein[i+1]>'9'||timein[i+1]<'0'){time1[j]=temp;j++;temp=0; continue;}
    }     
    temp=0;cout<<j<<' ';j=0;
    for(i=0;timeout[i]!=0;i++)
    {
                       if(timeout[i]>'9'||timeout[i]<'0'){continue;}
                       
                       temp*=10;temp+=timeout[i]-'0';
                       if(timeout[i+1]>'9'||timeout[i+1]<'0'){time2[j]=temp;j++;temp=0; continue;}
    }
    for(i=0;i<=j;i++)
          for(k=time1[i];k<time2[i];k++)p[k]++;
    for(j=0;j<1001;j++)if(max<p[j]){max=p[j];}
    cout<<max;
    getchar();getchar();
    return 0;
}
int main()
{
   int x[1001],y[1001];
   int f[1001];
   int i,j,n,ans;
   char ch;
    
 
   i=1; 
   scanf("%d%c",&x[1],&ch);
   while(ch==',')
   {
      i++;
      scanf("%d%c",&x[i],&ch);                           
   }  
   
   n=i;
   printf("%d ",n);
   i=1; 
   scanf("%d%c",&y[1],&ch);
   while(ch==',')
   {
      i++;
      scanf("%d%c",&y[i],&ch);                           
   }  
   
   for(i=0;i<=1000;i++)
      f[i]=0;
   
   for(i=1;i<=n;i++)
      for(j=x[i];j<y[i];j++)
         f[j]++;
   ans=0;
   for(i=0;i<=1000;i++)
     if(f[i]>ans)
       ans=f[i];
   printf("%d",ans);  
  
   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;
    }
    
    cout << ' ' << max;
    return 0;
}
/*
     ????????
     ??????
     ???2010-12-29
*/
int main()
{
	char c[1000];
	int num = 0, i, j, max = 1, flag[1000] = {0};           //flag[]?????????
	int x[1000], y[1000];               //?????????
	for(i = 0; c[i - 1] != '\n'; i++)
	{
		cin >> x[i];
		c[i] = cin.get();          //???????????
	}
	num = i;
    for(i = 0; c[i - 1] != '\n'; i++)
	{
		cin >> y[i];
        c[i] = cin.get();
	}
	for(i = 0; i < num; i++)
	{
		for(j = x[i]; j < y[i]; j++)
		{
			flag[j]++;
		}
	}
	for(i = 0; i < 1000; i++)
	{
		if(flag[i] > max) max = flag[i];
	}
	cout << num << " " << max << endl;
	return 0;
}
int main() 
{
int a[1010]={0};
int b[1010]={0};
int d[1010]={0};
int max1=2000,max2=0,max=0;
int  t;
int i,n=0;
char c;
for(i=1;;i++){
              scanf("%d%c",&a[i],&c);
              n++;
              if(c!=','){break;}
              }
for(i=1;;i++){
              scanf("%d%c",&b[i],&c);
              if(c!=','){break;}
              }
for(i=1;i<=n;i++){
                  if(a[i]<max1){max1=a[i];}
                  }
for(i=1;i<=n;i++){
                  if(b[i]>max2){max2=b[i];}
                  }
for(t=max1;t<max2;t=t+1){
      for(i=1;i<=n;i++){
            if(a[i]<=t&&b[i]>t){
                                d[t]++;
                                }
            }
      }
for(i=1;i<=max2-max1;i++){
                  if(d[i]>max){max=d[i];}
                  }
printf("%d %d\n",n,max);
	
	return 0;
}
//**********************************
//*??:????? ***
//*??:??? 1300012991 ***
//*??:2013?11?4? ***
//**********************************

int main()
{
	int n, i, j, count, num = 1; //????
	int a[1000] = {0};
	int b[1000] = {0};
	char sp; //????sp
//	int *a = new int [n]; //????a?b
//	int *b = new int [n];
	for (i = 0; ; i++) //??a????????????
	{
		cin >> a[i];
		sp = getchar();
		if (sp == '\n')
			break;
	}
	n = i + 1;
	for (i = 0; i < n; i++) //??b????????????
	{
		cin >> b[i];
		sp = getchar();
		if (sp == '\n')
			break;
	}
	for (i = 1; i < 1002; i++) //???????????????
	{
		count = 0;
		for (j = 0; j < n; j++)
		{
			if (i >= a[j] && i < b[j])
				count = count++;
		}
		num = (count > num ? count: num); //????
	}
	cout << n << " " << num;
	return 0;
}
int main()
{
     int i,j,n,m,temp,arrive[1600],leave[1600],times[1001]={0};
     char c;
     c=getchar();
     while(c!=EOF)
     {
       n=0;
       while(c!='\n')
       {
         m=c-'0';
         temp=0;
         while((m<=9)&&(m>=0))
         {
           temp=temp*10+m;
           c=getchar();
           m=c-'0';
          }
          arrive[n]=temp;
          n++;
          if(c==',')
	  c=getchar();
		  
         }
	c=getchar();
       n=0;
       while(c!='\n')
       {
         m=c-'0';
         temp=0;
         while((m<=9)&&(m>=0))
         {
           temp=temp*10+m;
           c=getchar();
           m=c-'0';
          }
          leave[n]=temp;
          n++;
          if(c==',')
	   c=getchar();
         }
	for(i=0;i<n;i++)
	{
		for(j=arrive[i];j<leave[i];j++)
			times[j]++;
	}
	int max=0;
	for(i=0;i<1000;i++)
	{
		if(max<times[i]) max=times[i];
	}
	printf("%d %d\n",n,max);
         while(c=='\n')
	  c=getchar();
		 
      }
}
int main()
{
	int i=0,j,x[1001],y[1001],count[1001];
	for(int t=0;t<1001;t++)  count[t]=0;
	char a;
	while(1)
	{
		cin>>x[i];
		if(cin.get()!=',')
			break;
		i++;
	}
	for(j=0;j<i;j++)
		cin>>y[j]>>a;
	cin>>y[i];
	for(j=0;j<=i;j++)
		for(int k=x[j];k<y[j];k++)
			count[k]++;
		int max=0;
    for(j=0;j<1001;j++)
	{
		if(count[j]>max)
			max=count[j];
	}
     cout<<i+1<<" "<<max<<endl;
	 return 0;
}
int main()
{
	int a[1000] = { 0 } , b[1000] = { 0 } ;
	int i , total , num , min , max , k ;
	char c ;
	i = 0 ;
	while ( c != '\n' ) 
	{
		cin >> num ;
		a[i] = num ;
		i++ ;
		c = cin.get() ;
	}
	for ( k = 0 ; k <= i - 1 ; k++ )
	{
		cin >> num ;
		b[k] = num ;
		c = cin.get() ;
	}
	total = i ;
	max = b[1] ;
	min = a[1] ;
	for ( i = 0 ; i <= total - 1 ; i++ )
	{
		if ( min >= a[i] )
			min = a[i] ;
		if ( max <= b[i] )
			max = b[i] ;
	}
	int x[1001] = { 0 } ;
	for ( k = 0 ; k <= total - 1 ; k++ )
		for ( i = a[k] ; i <= b[k] - 1 ; i++ )
			x[i] = x[i] + 1 ;
	int max1 = 0 ;
	for ( i = min ; i <= max ; i++ )
	{
		if ( max1 < x[i] )
			max1 = x[i] ;
	}
	cout << total << " " << max1 << endl ;
	return 0 ;
}
//?????



int main()
{
	int start[1000],end[1000],n,number[1000]={0},max=0;
	for(int i=0;;i++)               //??????????
	{
		char c;
		cin>>start[i];
		c=cin.get();
		if(c!=',')
		{
			n=i+1;
			break;
		}
	}
	cin>>end[0];
	for(int i=1;i<n;i++)
	{
		char c;
		cin>>c>>end[i];
	}
	for(int i=0;i<n;i++)         //?????????
	{
		for(int j=start[i];j<end[i];j++)
			number[j]+=1;
	}
	for(int i=0;i<1000;i++)         //??????
		if(number[i]>max)
			max=number[i];
	cout<<n<<' '<<max<<endl;    //??
	return 0;
}
int main()
{
	int a[1001],b[1001],n=0,m=0,k;
	char c;
	while(1)
	{
		n++;scanf("%d",&a[n]);scanf("%c",&c);
		if(c=='\n')
			break;
	}
	for(k=1;k<=n;k++)
	{
		if(k!=n)
			scanf("%d,",&b[k]);
		else
			scanf("%d",&b[k]);
	}
	printf("%d ",n);
	int i,j;
	int s[1001]={0},max=0;
	for(i=0;i<=999;i++)
	{
		for(j=1;j<=n;j++)
		{
			if(a[j]<=i&&b[j]>i)
			s[i]++;
		}
		if(s[i]>max)
			max=s[i];
	}
	printf("%d",max);

}
//********************
//**????????**
//**?????      **
//**???2013.10.31**
//????5.cpp		**
//********************
int main()
{
	int x[1000], y[1000], cnt[1001], num = 0, max, i;
	char ch;
	for (i = 0; ; i++)
	{
		cin >> x[i]; // ??x[i]
		num++; // ???????1
		ch = cin.get(); // ????????ch
		if (ch != ',') // ??????????????
			break;
	}
	for (i = 0; ; i++)
	{
		cin >> y[i]; // ??y[i]
		ch = cin.get(); // ????????ch
		if (ch != ',') // ??????????????
			break;
	}
	for (i = 1; i <= 1000; i++)
	{
		cnt[i] = 0; // ????????????0
		for (int j = 0; j <= num - 1; j++)
		{
			if (i >= x[j] && i < y[j]) // ??i?????j????	
				cnt[i]++; // ?i?????????1
		}
	}
	max = cnt[1]; // ?cnt[1]??????????
	for (i = 1; i <= 1000; i++)
	{
		if (max < cnt[i]) // ??max??cnt[i]
			max = cnt[i]; // ?cnt[i]????max
	}
	cout << num << ' ' << max << endl; // ???????????????
	return 0;
}
void main(void)
{
	int n=0,start[1000],end[1000];
	char c=',';
	while(c!='\n')
	{
		scanf("%d%c",&start[n],&c);
		n++;
	}

	int i;
	for(i=0;i<=n-1;i++)
		scanf("%d%c",&end[i],&c);

	int time=0;
	for(i=0;i<=n-1;i++)
		if(time<end[i])
			time=end[i];

	int member[1000],j;

	for(i=0;i<=time-1;i++)
		member[i]=0;

	for(i=0;i<=n-1;i++)
		for(j=start[i];j<end[i];j++)
			member[j-1]++;

	int max=0;
	for(i=0;i<=time-1;i++)
		if(max<member[i])
			max=member[i];

	printf("%d %d\n",n,max);
}