semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
//****************************************************************
// ???1000012789_7                                            *
// ???wusy                                                    *
// ???11,10                                                   *
// ???????                                                *
//****************************************************************
char x0[100000], y0[100000];
int x[1000], y[1000]; 
int main()
{
	int i, j, time[1000], people = 0, most = 0, max = 0;
	memset(x, 0, sizeof(x));
	memset(y, 0, sizeof(y));
	memset(time, 0, sizeof(time));

	cin.getline(x0,10000);
	cin.getline(y0,10000);

	for (i = 0; x0[i] != '\0'; i++)
	{
		if (x0[i] == ',')
			people++;
	}
	people++;

	j = 0;
	for (i = 0; x0[i] != '\0'; i++)
	{
		if (x0[i] != ',')
		{
			x[j] = x[j] * 10 + x0[i] - '0';
		}
		if (x0[i] == ',')
			j++;
	}

	j = 0;
	for (i = 0; y0[i] != '\0'; i++)
	{
		if (y0[i] != ',')
		{
			y[j] = y[j] * 10 + y0[i] - '0';
		}
		if (y0[i] == ',')
		{
			y[j]--;
			j++;
		}
	}

	for (i = 0; i <= people - 1; i++)
		for (j = x[i]; j <= y[i]; j++)
			time[j]++;

	for (i = 0; i <= 999; i++)
		if (time[i] > max)
			max = time[i];

	cout << people << " " << max << endl;
	return 0;
}
int main()
{
	int a[1000][2]={0},c[1000]={0},i,j,k=0,sum=0,max,min;
	char b;
	for(i=0;i<1000;i++)
	{
		scanf("%d%c",&a[i][0],&b);
		sum++;
		if(b!=',')
			break;
	}
	for(i=0;i<sum;i++)
		scanf("%d%c",&a[i][1],&b);
	min=a[0][0];
	max=a[0][1];
	for(i=0;i<sum;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++)
	{
		for(j=0;j<sum;j++)
		{
			if((a[j][0]<i||a[j][0]==i)&&(a[j][1]>i+1||a[j][1]==i+1))
				c[k]++;
		}
		k++;
	}
	max=c[0];
	for(i=0;i<k;i++)
	{
		if(c[i]>max)
			max=c[i];
	}
	printf("%d %d",sum,max);
	return 0;
}
int main()
{
	int n,p,i=1,j,k=1,l,a[1002],b[1002],count,max1=0;  //n?????p????????
	char 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;
	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;
		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 n=0,i,j,a[1000],b[1000],c[1000]={0},max,t=0;
	char d;
	do
	{
		scanf("%d",&a[n]);
		n++;
	}while((d=getchar())!='\n');
	for(i=0;i<n-1;i++)
	scanf("%d,",&b[i]);
	scanf("%d",&b[n-1]);
	for(i=0;i<n;i++)
		if(a[i]>t)t=a[i];
	for(i=0;i<n;i++)
		if(b[i]>t)t=b[i];
	for(i=0;i<t;i++)
		for(j=0;j<n;j++)
		if(i>=a[j]&&i<b[j])c[i]++;
	max=c[0];
	for(i=1;i<t;i++)
		if(max<c[i])max=c[i];
	printf("%d %d",n,max);
	return 0;
}
int main()
{
	int x[1000] , y[1000] , total , max ;
	char ch ;
	int i = 0 , j = 0 ;
    do
	{
		cin >> x[i] ;
		ch = cin.get() ;
		i++ ;
	}while(ch == ',') ;
	do
	{
		cin >> y[j] ;
		ch = cin.get() ;
		j++ ;
	}while(ch == ',') ;
	total = i ;
	int z[1000] = {0} ;
	for (int k = 0 ; k < total ; k++)
	{
		for (int q = x[k] ; q < y[k] ; q++)
		{
			z[q]++ ;
		}
	}
	int s = 0 ;
	for (int l = 0 ; l <= 998 ; l++)
	{
		if (z[l] > z[l+1])
		{
			s = z[l+1] ;
			z[l+1] = z[l] ;
			z[l] = s ;
		}
	}
	max = z[999] ;
	cout << total << " " << max ;
	return 0 ;
}
main ()
{
 int m=0,a[1000]={0},b[1000]={0},c[1000]={0},i,j,s=0,s1=1;
 char x;
 i=0;
 while(1)
 {
    scanf("%d",&a[i]);
    x=getchar();
    m=m+1;
    if(x!=',')break;
    i++;}
    i=0;
 while(1)
 {s++;
    scanf("%d",&b[i]);x=getchar();
    if(x!=',')break;
    i++;
 }

 for(i=0;i<1000;i++)
 {
        for(j=0;j<1000;j++)
        {
            if(i<b[j]&&i>=a[j])c[i]++;
        }
 }

  for(i=0;i<1000;i++)
  {
      if(c[i]>s1)s1=c[i];
  }
  printf("%d %d",s,s1);



}
int main()
{
 	int xi[1000], yi[1000], time[1000] = {0}; //xi??????yi?????,time???????? 
	int i = 0, max = 0,j = 0; //i?????,max??????????
	char c; //????????
	int temp; //temp???????????? 
	
	do
	{
 	  	 cin >> xi[i]; //??????
		 i++; //i????????1? 
 	} 
 	while ( ( c = cin.get() ) == ',' ); //?????????????,?????? 
	
 	do
	{
 	  	 cin >> yi[j]; //?????? 
 	  	 j++;
 	} 
 	while ( ( c = cin.get() ) == ',' ); //?????????????,??????
	

	for ( int j = 0; j < i; j++ ) //j??j?? 
	{
	 	for ( int k = xi[j]; k < yi[j]; k++ ) //k???? 
	 	{
		 	time[k] += 1;
	  	}	
	}
	
	for ( int j = 0; j < 1000; j++ )
	{
	 	if ( time[j] > max )
	 	   max = time[j];	
	} 

	 cout << i << " " << max;
	 
	 return 0;
}
int main()
{
    int i,j,n,x[1005],y[1005],mark,max=0;
    char c;
    scanf("%d",&x[0]);
    i=1;
    while((c=getchar())==',')
    {
        scanf("%d",&x[i]);
        i++;
    }
    scanf("%d",&y[0]);
    i=1;
    while((c=getchar())==',')
    {
        scanf("%d",&y[i]);
        i++;
    }
    n=i;
    for(i=0;i<1000;i++)
    {
        mark=0;
        for(j=0;j<n;j++)
        {
            if(i>=x[j]&&i<y[j])
            mark++;
        }
        max=(max>mark)?max:mark;
    }
    printf("%d %d",n,max);
}
int main ()
{
	int time[3][1005]={0}, i=1,j, num, tmax=0;
	int count[1005]={0}, countmax=0;
	char p=0;
	while ( p!='\n' )
	{
		cin >> time [1][i];
		p = cin.get();
		i++;
	}
	p=0,i=1;
	while ( p!='\n' )
	{
		cin >> time [2][i];
		p = cin.get();
		i++;
	}
	num = i-1;
	for ( i=1; i <=num; i++ )
		if ( time[2][i] > tmax )
			tmax = time [2][i];
	for ( i=1; i<=tmax; i++ )
	{
		for ( j=1; j <= num; j++ )
		{
			if ( time [2][j] > i &&  time [1][j] <= i )
				count[i]++;
		}
	}
	for ( i=1; i<=tmax; i++)
		if ( count[i] > countmax )
			countmax=count[i];
	cout << num << " " << countmax << endl;
	return 0;
}
int main(){

	int a[1000][2];
	int n=0;
	int num=0;

	while(true){

		cin>>a[n][0];

		n++;

		if(cin.get()!=',') break;
	}

	for(int i=0;i<n;i++){
		cin>>a[i][1];
                cin.get();
	}

	for(int i=0;i<1000;i++){
		int tmp=0;
		for(int j=0;j<n;j++){
			if(i>=a[j][0]&&i<a[j][1]){
				tmp+=1;
			}
		}
		if(tmp>num){
			num=tmp;
		}
	}

	cout<<n<<' '<<num;
	

	return 0;


	
}
struct men
{
	int x;
	int y;
}time[1000];

int main()
{
	int i=0,j,max=0,n,sum;
	char c;
	do
	{
		scanf("%d",&time[i].x);
		i++;
	}while((c=getchar())!='\n');
	i=0;
	do
	{
		scanf("%d",&time[i].y);
		i++;
	}while((c=getchar())!='\n');
	n=i;
	printf("%d ",n);
	for(i=0;i<1000;i++)
	{
		sum=0;
		for(j=0;j<n;j++)
		{
			if(i>=time[j].x&&i<time[j].y)
				sum++;
		}
		if(sum>max)
			max=sum;
	}
	printf("%d\n",max);
	return 0;
}
int main ()
{
	int come[1000], go[1000];
	int i, j, k, p = 0, max = 0;
	for ( i = 0; ; i++ )
	{
		cin >> come[i];
		if ( cin.get() == '\n')
			break;
	}
	for ( i = 0; ; i++ )
	{
		cin >> go[i];	// ?????????????
		if ( cin .get() == '\n')
			break;
	}
	for ( j = 0; j <= 1000; j++ )
	{
		for ( k = 0; k <= i + 1; k ++ )
		{
			if ( come[k] <= j && go[k] >= j + 1 )
				p = p + 1;
		}				// ??????????
		if ( max <= p )
			max = p; //?????
		p = 0;
	}
	cout << i + 1 << " " << max << endl;
	return 0;
}
/*	???:???
	???:1000012896 leo
	????:2010.12.1
	????:??????????
	*/
int main()
{
	int atime[10000], ltime[10000], min = 1000, max = 0, count = 0, per, maxp = 0, i, j;
	for (i = 1; ;i++)
	{
		cin >> atime[i];
		if (atime[i] < min)
			min = atime[i];
			if (getchar() == '\n')
			break;
	}
	for (i = 1; ;i++)
	{
		cin >> ltime[i];
		if (ltime[i] > max)
			max = ltime[i];
			if (getchar() == '\n')
			break;
	}
	count = i;
	for (j = min; j <= max - 1; j++)
	{
		per = 0;
		for (i = 1; i <= count; i++)
			if ( atime[i] <= j && ltime[i] > j)
				per ++;
		if (per > maxp)
			maxp = per;
	}
	cout << count << ' ' << maxp;
	return 0;
}
/* ???:main.cpp
 * ??????
 * ?????2012-11-11
 * ??????????????????????????????????????????????????????????????????????????i????????????????????xi, yi????????????????t?? xi <= t < yi????????????????????? 0 <= xi < yi<1000?????????????????????????????????????????
 */

int main ()
{
	int time[1001][3],tofbegin,tofend,//time???????????tofbegin,tofend?????????????????
		num,noft[1001],max,//num????noft?????????????max??????????
		t,i,j;//????
	char ignore;//??????????
	tofbegin = 1001;//?????
	tofend = 0;
	for ( j = 1; j <= 2; j++ )//????????????????tofbegin,tofend
	{
		ignore = '0';
		for ( i = 1; ignore != '\n'; i++ )//?????????????
		{
			cin >> time[i][j];
			cin.get(ignore);
			if ( tofbegin > time[i][j] )
				tofbegin = time[i][j];
			if ( tofend < time[i][j])
				tofend = time[i][j];
		}
	}
	num = i - 1;//?????
	max = 0;//???
	for ( t = tofbegin; t < tofend; t++ )//????????????
	{
		noft[t] = 0;//???
		for ( i = 1; i <= num; i++ )//????
			if ( t < time[i][2] && t >= time[i][1] )
				noft[t] += 1;
		if ( max < noft[t] )//??????????????
			max = noft[t];
	}
	cout << num << ' ' << max << endl;//????
	return 0;
}
int main()
{
   int a[1002][3],d[2010][3],i=1,j=1,count=0,tem=0,max=0;
   char b;
   for(i=1;;i++)
   {
      cin>>a[i][1];
      cin.get(b);
      count++;
      if(b=='\n')
      break;
   }
   for(j=1;;j++)
   {
      cin>>a[j][2];
      cin.get(b);
      if(b=='\n')
      break;
   }
   for(i=1;i<=count;i++)
      for(j=1;j<=2;j++)
         d[i][j]=a[i][j];
   for(i=1;i<=count-1;i++)
      for(j=1;j<=count-i;j++)
      {
         if(d[j][1]>d[j+1][1])
         {
            tem=d[j][1];
            d[j][1]=d[j+1][1];
            d[j+1][1]=tem;
         }
         if(d[j][2]>d[j+1][2])
         {
            tem=d[j][2];
            d[j][2]=d[j+1][2];
            d[j+1][2]=tem;
         }
      }
      double k=0.0;
      for(k=d[1][1];k<=d[count][2];k+=0.5)
      {
         int num=0;
         for(j=1;j<=count;j++)
         {
            if(a[j][1]<=k && k<a[j][2])
            num++;
         }
         if(num>max)
          max=num;
      }
      cout<<count<<" "<<max;
      return 0;
}
//
//	????:	?????
//	????:	?????????????????????????????????????
//	????:	?  ? ( ? ? : 1000012733 ) 
//	????:	2010 ? 12 ? 01 ?
//
int main()
{
	int timein[1000], timeout[1000], max[1000];
	int i, j, k, count = 1;
	char c;
	memset ( timein, 0, sizeof ( timein ));
	memset ( timeout, 0, sizeof ( timeout ));
	memset ( max, 0, sizeof ( max ));
	for ( i = 0; i < 1000; i ++ )
	{
		cin >> timein[i];
		c = cin.get();
		if ( c == '\n' )
			break;
		else count ++;
	}
	for ( i = 0; i < 1000; i ++ )
	{
		cin >> timeout[i];
		c = cin.get();
		if ( c == '\n' )
			break;
	}
	for ( i = 0; i < 1000; i ++ )
		for ( j = 0; j < count; j ++ )
		{
			if (( timein[j] <= i ) && ( timeout[j] > i ))
				max[i] ++;
		}
	k = 0;
	for ( i = 1; i < 1000; i ++ )
	{
		if ( max[k] < max[i] )
		{
			k = i;
		}
	}
	cout << count << " " << max[k] << endl;
	return 0;
}
void main()
{
	int m,n,i,j,a=0,w=0,c=0;
	int s[1001],t[1001];
    scanf("%d",&s[c]);
	while(getchar()==',')
	{
		c++;
		scanf("%d",&s[c]);
	}
	m=c;
	c=0;
   scanf("%d",&t[c]);
	while(getchar()==',')
	{
		c++;
		scanf("%d",&t[c]);
	}

	for(i=0;i<10001;i++)
	{
		for(j=0;j<=m;j++)
		{

		 if(i>=s[j]&&i<t[j])
		 {
			 w++;
		 }
		}
		if(w>a)
			a=w;
		w=0;
	}
	c=(m+1);
	printf("%d %d",c,a);
}
int main()
{
	int time[1001] = {0};
	char x[10000] , ch;
	int tem[1001] , max = 0 , count = 1 , len;
	int come[1001] , go[1001];
    int i , j;
	cin.getline( x , 10000 , '\n');
	len = strlen(x);
	for(i =0; i<= 1000;i++) time[i] = 0;
	for (i = 0 ; i <= len - 1 ; i++)
	{
		if (x[i] == ',')
		{
			tem[count] = i;
			count++;
		}
		tem[count] = len;
		tem[0] = -1;
	}
	for (i = 1 ; i <= count ; i++)
	{
		if ((tem[i] - tem[i - 1]) == 2)
		{
			come[i] = x[tem[i] - 1] - 48;
		}
		if ((tem[i] - tem[i - 1]) == 3)
		{
			come[i] = x[tem[i] - 1] - 48 + 10 * (x[tem[i] - 2] - 48);
		}
		if ((tem[i] - tem[i - 1]) == 4)
		{
			come[i] = x[tem[i] - 1] - 48 + 10 * (x[tem[i] - 2] -48) + 100 * (x[tem[i] - 3] - 48);
		}
	}
	for (i = 1 ; i <= count -1 ; i++)
	{
		cin >> go[i] >> ch;
	}
	cin >> go[count];
	for (i = 1 ; i <= count ; i++)
	{
		for (j = come[i] ; j < go[i] ; j++)
		{
			time[j]++;
		}
	}
	for (i = 0 ; i <= 999 ; i++)
	{
		if (time[i] > max)
		{
			max = time[i];
		}
	}
	cout << count << ' ' << max << endl;
	return 0;
}
int main()
{
	int list1[1000];
	int list2[1000];
	scanf("%d",&list1[0]);
	int count=1;
	while(scanf(",%d",&list1[count++])!=0);
	count--;
	int index=1;
	scanf("%d",&list2[0]);
	while(scanf(",%d",&list2[index++])!=0);

	int max=0;
	int num=0;
	int i=0;
	for(i=0;i<1000;i++)
	{
		num=0;
		for(index=0;index<count;index++)
		{
			if(i>=list1[index] && i<list2[index])
				num++;
		}
		if(num>max)
			max=num;
	}

	printf("%d %d",count,max);
	return 0;
}
int main()
{
	int c[10000][2],d[10000],e[10000],i=0,j,t=0,m,n=-1,most=0,max=0,min=1000,pause;
	char a[10000],b[10000];
	memset(c,0,sizeof(c));
	memset(e,0,sizeof(e));
	cin>>a;
	for(i=0;i<10000;i++)
	{
		if(a[i]!=','&&a[i]!='\0')
			d[i]=a[i]-'0';
		if(a[i]==',')
		{
			m=i;
			for(j=n+1;j<m;j++)
				c[t][0]=10*c[t][0]+d[j];
			n=m;
			if(min>c[t][0])
				min=c[t][0];
			t++;
		}
		if(a[i]=='\0')
		{
			m=i;
			for(j=n+1;j<m;j++)
				c[t][0]=10*c[t][0]+d[j];
			n=m;
			if(min>c[t][0])
				min=c[t][0];
			t++;
			break;
		}
	}
	n=-1;
	t=0;
	cin>>b;
	for(i=0;i<10000;i++)
	{
		if(b[i]!=','&&b[i]!='\0')
			d[i]=b[i]-'0';
		if(b[i]==',')
		{
			m=i;
			for(j=n+1;j<m;j++)
				c[t][1]=10*c[t][1]+d[j];
			n=m;
			if(max<c[t][1])
				max=c[t][1];
			t++;
		}
		if(b[i]=='\0')
		{
			m=i;
			for(j=n+1;j<m;j++)
				c[t][1]=10*c[t][1]+d[j];
			n=m;
			if(max<c[t][1])
				max=c[t][1];
			t++;
			break;
		}
	}
	for(i=min;i<max;i++)
	{
		for(j=0;j<t;j++)
			if(c[j][0]<=i&&c[j][1]>i)
				e[i]++;
		if(most<e[i])
			most=e[i];
	}
	cout<<t<<" "<<most<<endl;
	return 0;
}
//*********************** 
//?????????? 
//?????? 1300012849 
//???2013?11?1? 
//*********************** 
int main ()
{
    int sum = 0;                              //????????sum 
    char c;                                   //??cin.get()??????c 
    int i = 0 , j , p;
    int a[1000];                              //???????????????????????????? 
    int tmax = 0;                             //????????????tmax????0 
    while ( cin >> a[i])                      //???????????+1?????????? 
    {
          sum++;
          c = cin.get();
          if ( c == ',')                      //????????????????????????? 
               i++;
          else                                //????????????????????sum???????? 
               break;
    }
   
    int b[sum];                               //????sum??????b??????????????? 
    for ( i = 0; i <= sum - 1; i++ )          //??????????????b????? 
    {
        cin >> b[i];
        cin.get();
    }
   //????i????????????????????a[i-1],b[i-1]
    
   int d[1000];                               //??????d?????????????????d[0]??0?????????d[15]??15???????? 
   for ( i = 0; i <= 999; i++ )               //??????????????0 
         d[i] = 0;
   
   //?????a[i]?????b[i]????????J??? J >= a[i] ? J < b[i]??????????d[j]++???j?????????+1 
   for ( i = 0; i <= sum - 1; i++ )           
   {                                          
       for ( j = 0; j <= 999; j++ )
       {
           if ( j >= a[i] && j < b[i] )
                d[j]++;
       }
   }
   
   //for ( i = 1; i <= 999; i++ )               //??????d??????????????????????d[999]????????????? 
//   {
//       for ( j = 0; j <= 999 - i; j++ )
//       {
//           if ( d[j] > d[j+1])
//           {
//                p = d[j+1];
//                d[j+1] = d[j];
//                d[j] = p;
//           }
//       }
//   }
   
   for ( i = 0; i <= 999; i++ )
   {
       if ( tmax < d[i] )
            tmax = d[i];
   } 
   cout << sum << " "<< tmax << endl;
}
int main()
{
	char c;
	int a[1000],b[1000];
	int i=0,d,m,max,t=0;
	while((c=getchar())!='\n')
	{
		if(c!=','&&t==0)
		{
			a[i]=c-'0';
			t=1;
			i++;
		}
		else if(c!=','&&t==1)
		{
			i--;
			a[i]=a[i]*10+c-'0';
			t=1;
			i++;
		}
		else
		{
			t=0;
			continue;
		}
	}
	d=i;
	i=0;t=0;
	while((c=getchar())!='\n')
	{
		if(c!=','&&t==0)
		{
			b[i]=c-'0';
			t=1;
			i++;
		}
		else if(c!=','&&t==1)
		{
			i--;
			b[i]=b[i]*10+c-'0';
			i++;
		}
		else
		{
			t=0;
			continue;
		}
	}
	max=0;t=0;
	while(t<1000)
	{
		m=0;
		for(i=0;i<d;i++)
		{
			if(a[i]<=t&&b[i]>t)
				m++;
		}
		if(m>max)
			max=m;
		t=t+1;
	}
	printf("%d %d",d,max);
	return 0;
}
void main()
{
	int max(int a[],int n);
	int min(int a[],int n);
	int a[1000],b[1000],i=1,j,c[1000]={0},count=0,n,maxa,maxb,mina,minb,max_,min_,max0,maxman;
	scanf("%d",&a[0]);
	while(getchar()==',')
	{
		scanf("%d",&a[i]);
		i++;
	}
	n=i;
	i=1;
	scanf("%d",&b[0]);
	while(getchar()==',')
	{
		scanf("%d",&b[i]);
		i++;
	}
	maxa=max(a,n);
	maxb=max(b,n);
	mina=min(a,n);
	minb=min(b,n);
	if(maxa>=maxb)max_=maxa;else max_=maxb;
	if(mina<=minb)min_=mina;else min_=minb;
	for(max0=min_;max0<=max_;max0++)
	{
		for(i=0;i<n;i++)
		{
			if(max0>=a[i]&&max0<b[i])
				c[count]++;
		}
		count++;
	}	
	count--;
	maxman=c[0];
	for(i=1;i<=count;i++)
	{
		if(c[i]>=maxman)maxman=c[i];
	}
	printf("%d %d\n",n,maxman);
}

int max(int a[],int n)
{
	int b,i;
	b=a[0];
	for(i=1;i<n;i++)
	{
		if(a[i]>=b)b=a[i];
	}
	return b;
}

int min(int a[],int n)
{
	int b,i;
	b=a[0];
	for(i=1;i<n;i++)
	{
		if(a[i]<=b)b=a[i];
	}
	return b;
}
int main()
{
	int x[1000], y[1000], p[1000] = {0}, n, i, j;
	cin >> x[0];
	i = 1;
	while (cin.get() != '\n')
	  cin >> x[i++];
	n = i;
	for (i = 0; i < n; i++)
	{
		cin >> y[i];
		cin.get();
		for (j = x[i]; j < y[i]; j++)
		  p[j]++;
	}
	i = 0;
	for (j = 1; j < 1000; j++)
	  if (p[j] > p[i])
	    i = j;
	cout << n << ' ' << p[i];
	return(0); 
 }
//********************************
//*???5.cpp   **
//*????????   **
//*?????? 1300012838 **
//*???2013.10.30  **
//********************************

int main()
{ 
    int time[1000], in[1000], out[1000], num = 1, max = 0;
    for (int i = 0; i < 1000; i++)
    {
        time[i] = 0;
    }
    cin >> in[0];
    while (cin.get() == ',')
    {
        cin >> in[num];
        num++;
    }
    for (int j = 0; j < num; j++)
    {
        cin >> out[j];
        for (int k = in[j]; k < out[j]; k++)
        {
            time[k]++;
        }
        cin.get();
    } 
    for (int l = 0; l < 1000; l++)
    {
        if (time[l] > max)
        {
            max = time[l];
        }
    }
    cout << num << " " << max << endl;

    return 0;                    
}
void main()
{
	int it[1001],ot[1001],tr[1001]={0},i,j,k,a,b,c,rs,trm=0;
	for(i=0;;i++)
	{
	scanf("%d",&it[i]);
	if((c=getchar())=='\n')
		break;
	}
	rs=i+1;
	for(i=0;i<rs;i++)
	{
		scanf("%d",&ot[i]);
		getchar();
	}





	for(i=0;i<rs;i++)
	{
		for(j=it[i];j<ot[i];j++)
			tr[j]++;
	}
	for(j=0;j<1000;j++)
	{
		if(tr[j]>trm) trm=tr[j];
	}
	printf("%d %d",rs,trm);


}
int input(int a[],int b[],int c[])
{
	int m=0;
	int small,big;
	char cd;
	scanf("%d",&a[m]);
	small=a[m];
	while((cd=getchar())!='\n')
	{
		m=m+1;
		scanf("%d",&a[m]);
		if(a[m]<small)
			small=a[m];
	}
	m=0;
	scanf("%d",&b[m]);
	big=b[m];
	while((cd=getchar())!='\n')
	{
		m=m+1;
		scanf("%d",&b[m]);
		if(b[m]>big)
			big=b[m];
	}
	c[0]=small;
	c[1]=big;
	return (m+1);
}

void count(int a[],int b[],int d[],int r)
{
	int i;int j;
	for(i=0;i<r;i++)
		for(j=a[i];j<b[i];j++)
			d[j]++;
	
}
int maxi(int c[],int d[])
{
	int i;
	int max=d[c[0]];
	for(i=c[0]+1;i<c[1];i++)
	{
		if(d[i]>max)
			max=d[i];
	}
	return max;


}
void main()
{
	int a[N],b[N];
	int d[1001]={0};
	int c[2];
	int i=0;
	int r,max;
	r=input(a,b,c);
	count(a,b,d,r);
	max=maxi(c,d);
	printf("%d %d",r,max);
	

}
/*
 * ?????????
 *  ????: 2010-12-19
 *    ??????
 */

int main(){int a[1000];
int b[1000]; //????????????????????????
char str; //???????????????????????
int n = 0;
while (1)
{
cin >> a[n];
str = getchar(); //????????????????????
if (str == '\n') //?????????????????
break;
n ++;
}
n=0;
while (1)
{
cin >> b[n]; //????????????????????
str = getchar();
if (str == '\n') //?????????????????
break;
n++; //k????????
}
int min=10000,max=0,imax=0;
		for(int i=0;i<=n;i++){
			if(a[i]<=min)
				min=a[i];
			if(b[i]>max)
				max=b[i];
			}
		for(int i=min;i<=max;i++){
		int temp=0;
		for(int k=0;k<=n;k++)
			if((a[k]<=i)&&(b[k]>i))
				temp++;
		if(temp>imax)
			imax=temp;
	}
	 cout<<n+1<<' '<<imax;
	return 0;
}
int max(int a,int b)
{return(a>b?a:b);}
int main()
{
    int imax=0,s=0,x[2200],y[2200],i=0,j,k,m;
    char c;
    do
    {
      scanf("%d",&x[i]);
      y[i]=1;
      i++;  
    }
    while((c=getchar())!='\n');
    printf("%d ",i);
    do
    {
      scanf("%d",&x[i]);
      x[i]--;
      y[i]=-1;
      i++; 
    }
    while((c=getchar())!='\n');
    for(j=0;j<i;j++)
    {
    for(k=i-1;k>j;k--)
    {
      if(x[k]<x[k-1])
      {
        m=x[k];
        x[k]=x[k-1];
        x[k-1]=m;
        m=y[k];
        y[k]=y[k-1];
        y[k-1]=m;             
      }                
    }
    s+=y[j];
    imax=max(imax,s);
    }
    printf("%d",imax);
    return 0;
}
int main()
{
	int i, j;
	int x[1000 + 1];
	int y[1000 + 1];
	int flag[1000 + 1]={0};
	char p;
    int number , n;
	int max , sum , a = 0 , k; 
	max = 1;
	number = 1;

	for(i = 1 ; i <= 2 ; i ++)
	{	
		while(1)
		{
			scanf("%c",&p);
			if(p == '\n' || p == ',') 
			{
				
				if(i == 1)
				{
					x[number] = a;
					number ++ ;
				}
				else
				{
					y[number] = a;
					number ++ ; 
				}
				a = 0;
				if( p == '\n') 
					break;
			}
            else   
		    a = a * 10 + p - '0';
		}
		n = number - 1;
		number = 1;
	}

	for( i = 1 ; i <= n ; i ++)
	{
		for( j = x[i] ; j < y[i] ; j ++)
		{
			flag[j] ++;

		}
	}


	for( i = 0 ; i < 1000; i ++)
	{
		if(max < flag[i])
		max = flag[i] ; 
	}
	printf("%d %d\n",n ,max);
	
	return 0;
}
//********************************
//*????????   **
//*?????? 1300012861 **
//*???2013.10.31  **
//********************************
int main()
{
	int x[1002], y[1002], z[1002] = {0}, i, j, count, t; 
	char c; 
	count = 1; 
	i = 1; 
	cin >> x[0];
	c = cin.get(); //??????
	while ( c == ',' ) //???????????????
	{
		count++; //??+1
		cin >> x[i];
		c = cin.get(); //??????
		i++; 
	}
	i = 1; //????
	cin >> y[0];
	c = cin.get(); 
	while ( c == ',' )
	{ 
		cin >> y[i];
		c = cin.get(); 
		i++; 
	}
	i--; 
	for ( ; i >= 0; i-- )
	{
		for ( j = x[i]; j < y[i]; j++ ) //??????????????+1
			z[j]++; 
	} 
	for ( j = 1; j <= 1000; j++ )
	{
		if ( z[j] < z[j-1] ) //????z????? ????????????
			z[j] = z[j-1]; 
		t = z[j]; 
	}
	cout << count << " " << t << endl; 
	return 0;
}
int main()
{
	char a[5000];
	char b[5000];
	cin >> a >> b;
	int n = 1;
	for(int l = 0; a[l] != '\0'; l++)
		if(a[l] == ',')
			n++;
	cout << n << " ";
	char come[2500][4], go[2500][4];
	int i = 0, j = 0, k = 0;
	for( ; i < strlen(a); i++)
	{
		if(a[i] != ',')
		{
			come[j][k] = a[i];
			k++;
		}
		else
		{
			come[j][k] = '\0';
			j++;
			k = 0;
		}
	}
	come[j][k] = '\0';
	i = 0, j = 0, k = 0;
	for( ; i < strlen(b); i++)
	{
		if(b[i] != ',')
		{
			go[j][k] = b[i];
			k++;
		}
		else
		{
			go[j][k] = '\0';
			j++;
			k = 0;
		}
	}
	go[j][k] = '\0';
	int come1[2500];
	int go1[2500];
	for(i = 0; i < n; i++)
	{
		come1[i] = atoi(come[i]);
		go1[i] = atoi(go[i]);
	}
	int max = 0;
	int peo = 0;
	for(int time = 1; time < 1000; time++)
	{
		for(int num = 0; num < n; num++)
		{
			if(come1[num] <= time && time < go1[num])
				peo++;
		}
		if(peo > max)
			max = peo;
		peo = 0;
	}
	cout << max << endl;
}
int main()
{
	int time[2][1000];
	int n, i, j, k;
	char c[2][1000];
	int max, min;
	int mostpeople, countpeople;
	for (i = 0; i < 2; i++)
	{
		for (j = 0; ; j++)
		{
			cin >> time[i][j];
			c[i][j]=cin.get();
			if (c[i][j] != ',')
				break;
		}
	}
	n = j;
	cout << n + 1<< " ";
	min = time[0][0];
	for (j = 0; j <= n; j++)
	{
		if (min > time[0][j])
			min = time[0][j];
	}
	max = time[1][0];
	for (j = 0; j <= n; j++)
	{
		if (max < time[1][j])
			max = time[1][j];
	}
	mostpeople = 0;
	for (k = min; k <= max; k++)
	{
		countpeople = 0;
		for (j = 0; j <= n; j++)
		{
			if ((k >= time[0][j]) && (k < time[1][j]))
				countpeople += 1;
		}
		if (mostpeople < countpeople)
			mostpeople = countpeople;
	}
	cout << mostpeople;
	return 0;
}
main()
{
	int i=0,j,a[2000],b[2000],k,m,p,q;
	char c;
	scanf("%d%c",&k,&c);
	while(c!='\n')
	{
		a[i]=k;
		i++;
		scanf("%d%c",&k,&c);
	}
	a[i]=k;
	for(j=0;j<=i;j++)
	{
		scanf("%d,",&b[j]);
	}
	scanf("%d",&b[j]);
	printf("%d ",i+1);
	p=0;
	q=0;
	for(m=0;m<1000;m++)
	{
		for(j=0;j<=i;j++)
		{
			if(m>=a[j]&&m<b[j])
				q++;
		}
		if(q>=p)
			p=q;
		q=0;
	}
	printf("%d\n",p);
}