semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
	int a[1000]={0},b[1000]={-1},c[1000]={-1},i,j;
	int k=0,p,q,h=0;
   char s=',';
   scanf("%d",&b[0]);
   for(i=1;s=getchar()==',';i++){
	   scanf("%d",&b[i]);}
s=',';
      scanf("%d",&c[0]);
   for(j=1;s=getchar()==',';j++){
	   scanf("%d",&c[j]);}

   
	   for(p=0;p<i;p++){q=0;
	   for(;b[p]+q<c[p];){
		   a[b[p]+q]++;q++;}}

	   
	   for(p=0;p<1000;p++){
		   for(q=0;q<1000-p-1;q++){
			   if(a[q]<a[q+1])k=a[q],a[q]=a[q+1],a[q+1]=k;}}

	   printf("%d %d\n",i,a[0]);}
int main()
{
    int intime,outtime;
    int time[1000]={0};
    int count=0;
    char a;
    int i;
    do 
    {
        cin >> intime;
        count++;
        for (i=intime;i<1000;i++)
        {
            time[i]++;
        }
        cin.get(a);
    }
    while (a!='\n');
    do 
    {
        cin >> outtime;
        
        for (i=outtime;i<1000;i++)
        {
            time[i]--;
        }
        cin.get(a);
    }
    while (a!='\n');
    int max=time[0];
    for (i=1;i<1000;i++)
    {
        if (time[i]>max)
        {
            max=time[i];
        }
    }
    cout << count << " " << max << endl;


    return 0;
}
//********************************
//*????5.cpp   **
//*?????? 1300012966 **
//*???2013.10.30  **
//*????????   **
//********************************
int main()
{
	int i, j, k, x[1001], y[1001], m[1001] = {0}, n;
	char s;
	i = 1;
	cin >> x[1];
	s = cin.get();
	while (s == ',')
	{
		i++;
		cin >> x[i];
		s = cin.get();
	}
	i = 1;
	cin >> y[1];
	s = cin.get();
	while (s == ',')
	{
		i++;
		cin >> y[i];
		s = cin.get();
	}
	for (j = 1; j <= 1000; j++)
	{
		for (k = 1; k <= i; k++)
		{
			if (j >= x[k] && j < y[k])
			{
				m[j]++;
			}
		}
	}
	n = 0;
	for (j = 1; j <= 1000; j++)
	{
		if( n < m[j])
		{
			n = m[j];
		}
	}
		cout << i << " " << n;
	return 0;
}
int main()
{
	int i=0,n=0,j;
	int a[1000],b[1000],c[1001];
	char comma;
	int max=0;
	
	memset(c,0,sizeof(c));

	while (cin>>a[n++])
	{
		comma=getchar();
		if (comma!=',') break;
	}

	for (i=0;i<n;i++)
	{
		cin>>b[i];
		if (i<n-1) getchar();

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

	cout<<n<<" "<<max<<endl;;

	return 0;


}
char s[100000],e[100000];
int f[1010];

int main()
{
	int i,j,st,et,ans,k;
	scanf("%s%s",s,e);
	for(i=0;i<1010;i++)f[0]=0;
	ans=0;
	i=j=0;
	while(s[i]!='\0'&&e[j]!='\0')
	{
		st=et=0;
		while(s[i]>='0'&&s[i]<='9'){st*=10;st+=s[i]-'0';i++;}
		i++;
		while(e[j]>='0'&&e[j]<='9'){et*=10;et+=e[j]-'0';j++;}
		j++;
		ans++;
		for(k=st;k<et;k++)
			f[k]++;
	}
	int max=-1;
	for(i=0;i<1010;i++)
		if(f[i]>max)max=f[i];
	printf("%d %d\n",ans,max);
	
	return 0;
}
//??????????????????????
//??:???????????????
//????wayne
//????:11.5
int main()
{
	int a[1001],b[1001],count[1001];   //a,b??????????
	int i,j,n,max,min,maxcount;
	char x[100000],y[100000];          //???????????
	cin>>x; 
	n=1,a[1]=0;                        
	for (i=0;;i++) 
	{
		if (x[i]==',')
		{
			n=n+1;                    //??","??????????
			a[n]=0;                  //?????????0
		}
		else if (x[i]=='\0')          //??"\0"??????????
			break;                    //???????
		else
		{
			a[n]=a[n]*10+x[i]-48;    //?ascii???????
		}
	}
	cin>>y;                         //????????????????
	n=1,b[1]=0;
	for (i=0;;i++)
	{
		if (y[i]==',')
		{
			n=n+1;
			b[n]=0;
		}
		else if (y[i]=='\0')
			break;
		else
		{
			b[n]=b[n]*10+y[i]-48;
		}
	}
	max=0,min=1000;    
	for (i=1;i<=n;i++)
	{
		if (max<b[i])  max=b[i];    //????????????????????
		if (min>a[i])  min=a[i];
	}
	maxcount=0;
	for (i=min;i<=max-1;i++)
	{
		count[i]=0;                //????????????0
		for (j=1;j<=n;j++)
	    	if (a[j]<=i&&b[j]>=i+1)   //??????????????????????
			    count[i]=count[i]+1;
		if (maxcount<count[i])  maxcount=count[i];  //????????????????
	} 
	cout<<n<<" "<<maxcount<<endl;
	return 0;
}
void main()
{
	int a[1001][2]={0},n=1,i=0,j,min,max,sum,MAX=0;
	char c;
	scanf("%d",&a[0][0]);
	min=a[0][0];
	while((c=getchar())!='\n')
	{
		scanf("%d",&a[n++][0]);
		if(a[n-1][0]<min)min=a[n-1][0];
	}
	scanf("%d",&a[0][1]);
	n=1;
	max=a[0][1];
	while((c=getchar())!='\n')
	{
		scanf("%d",&a[n++][1]);
		if(a[n-1][1]>max)max=a[n-1][1];
	}

	for(i=min;i<=max;i++)
	{
		sum=0;
		for(j=0;j<n;j++)
			if(i>=a[j][0]&&i<a[j][1])sum++;
		if(sum>MAX)MAX=sum;
	}
	printf("%d %d\n",n,MAX);
}
int main()
{
  int x , y , n , i , j , l , max ;
  char c ;
  n = 0 ;
  int m[1000]={0};
  for ( i=0 ; ; i++ )
  {
   if (i%2==0)
     {
       cin>>x;
       m[i/2]= x;
       n++;
     }
   else
    {
      c=cin.get();
      if (c==',')
        {
          continue;
        }
      else
        {
          break;
        }
    }
  }
  int a[n] , b[n] , t[n] ;
  for ( i=0 ; i<=n-1 ; i++ )
   {
     a[i]=m[i];
   }
  for ( i=0 ; i<=2*n-2 ; i++ )
   { 
     if (i%2==0)
      {
        cin>>y;
        b[i/2]=y;
      }
     else
      {
        c=cin.get();
      }
   }
  for ( i=0 ; i<=n-1 ; i++ )
   {
     l=0 ;
     for ( j=0 ; j<=n-1 ; j++)
       {
         if ((a[i]>=a[j])&&(a[i]<b[j]))
           {
             l++ ;
           }
        }
     t[i]=l;
    }
  max=t[0];
  for ( i=1 ; i<=n-1 ; i++)
   {
    if ( t[i]>max)
     {
       max=t[i];
     }
   }
  cout<<n<<" "<<max;
 return 0; 
}
void main()
{
	int a[1001]={0},b[1001]={0},p[1001]={0},s=0,j,i,ma;
	char c;
	while(1)
	{
		scanf("%d%c",&a[s],&c);
		s+=1;
		if(c!=',')
			break;
	}
	printf("\n");
	s=0;
	while(1)
	{
		scanf("%d%c",&b[s],&c);
		s+=1;
		if(c!=',')
			break;
	}
	for(i=0;i<1000;i++)
	{
		for(j=0;j<s;j++)
		{
			if(i>=a[j]&&i<b[j])
				p[i]+=1;
		}
	}
	ma=p[0];
	for(i=0;i<1000;i++)
	{
		if(p[i]>ma)
			ma=p[i];
	}


	printf("%d %d",s,ma);

}
int main()
{
	int x[1001], y[1001];
	char comma;
	int i, j;
	for(i = 1;;i++)
	{
		cin >> x[i];
		comma = cin.get();
		if(comma == ',')
			continue;
		if(comma == '\n')
			break;
	}
	for(i = 1;;i++)
	{
		cin >> y[i];
		comma = cin.get();
		if(comma == ',')
			continue;
		if(comma == '\n')
			break;
	}
	int num = i;
	int time[1001] = {0};
	for(i = 1; i <= num; i++)
		for(j = x[i]; j < y[i]; j++)
			time[j]++;
	int max = time[1];
	for(i = 1; i <= 1000; i++)
		if(max < time[i])
			max = time[i];
	cout << num << " " << max << endl;
	return 0;
}
int main()
{
	int people[1000][2],sum=1,time[1000]={0};
	cin>>people[0][0];
	while(scanf(",%d",&people[sum++][0]));
	cin>>people[0][1];
	sum=1;
	while(scanf(",%d",&people[sum++][1]));

	for(int i=0;i<sum;i++){
		for(int j=people[i][0];j<people[i][1];j++)	time[j]++;
	}
	int max=0;
	for(int i=0;i<1000;i++){
		if(time[i]>max) max=time[i];
	}
	cout<<sum-1<<" "<<max<<endl;
}
int main()
{
	int m=0,n=0,i,j,len1,len2;
	int a[1000],b[1000],c[1000]={0};
	char e,d;

	for(i=1;;i++){
		scanf("%d%c",&a[i],&e);
		if(e=='\n'){
			break;
		}
	}

	for(j=1;;j++){
		scanf("%d%c",&b[j],&d);
		if(d=='\n'){
			break;
		}
	}
	printf("%d ",i);
	m=i;
	
		for(j=1;j<1000;j++){
             for(i=1;i<=m;i++){
		    	if(j>=a[i]&&j<b[i]){
					c[j]=c[j]+1;
				}
			 }
		}
		for(i=1;i<1000;i++){
			if(c[1]<c[i]){
				c[1]=c[i];
			}
		}
		printf("%d",c[1]);
	return 0;
}
int main()
{
    int a[1001],b[1001],x[1001],i,j,k,l,m=0,n;
    char c;
    c=','; 
    scanf("%d",&a[1]);
    i=2;
    while (scanf(",%d",&a[i])) i++;
    scanf("%d",&b[1]);
    i=2;
    while (scanf(",%d",&b[i])) i++;
    n=i-1;
    for (i=1;i<=n;i++)
        for (j=a[i];j<b[i];j++)
             x[j]++;
    l=0;
    for (i=0;i<=1000;i++)
        if (x[i]>l) l=x[i];
    printf("%d %d",n,l);
    scanf("%d",&i);
}
void main()
{
	char str1[5000],str2[5000];
	int x[1001],y[1001];
	int i,j,k=0,min=1000,max=0,high=0,count=0,num;
	for(i=0;i<=1000;i++)
	{
		x[i]=0;
		y[i]=0;
	}
	gets(str1);
	gets(str2);
	for(i=0;i<strlen(str1);)
	{
		if(str1[i]>='0'&&str1[i]<='9')
		{
			for(j=i;str1[j]>='0'&&str1[j]<='9';j++)
			{
				x[k]=x[k]*10+str1[j]-'0';
			}
			if(x[k]<min)
				min=x[k];
			k++;
			count++;
			i=j;
		}
		else i++;
	}
	k=0;
	for(i=0;i<strlen(str2);i++)
	{
		if(str2[i]>='0'&&str2[i]<='9')
		{	
			for(j=i;str2[j]>='0'&&str2[j]<='9';j++)
			{
				y[k]=y[k]*10+str2[j]-'0';
			}
			if(y[k]>max)
				max=y[k];
			k++;
			i=j;
		}
		else i++;
	}
	for(i=min;i<=max;i++)
	{
		num=0;
		for(j=0;j<count;j++)
		{
			if(x[j]<=i&&y[j]>i)
				num++;
		}
		if(num>high)
			high=num;
	}
	printf("%d %d\n",count,high);
}
void main()
{  int n=0,m,f,i,j=-1,l1,l2;char q[10000],w[10000];int a[1000]={0},b[1000]={0};int c[1000]={0},k,flag=0;
   scanf("%s",q);
   scanf("%s",w);
   l1=strlen(q);l2=strlen(w);
   for(k=0;k<l1;k++)
        for(j=j+1;j<l1;j++)
       {
           if(q[j]<'0'||q[j]>'9')  {flag++;break;}
           else a[k]=a[k]*10+q[j]-'0';
       }
   f=flag+1;j=-1;
   for(k=0;k<l2;k++)
        for(j=j+1;j<l2;j++)
       {
           if(w[j]<'0'||w[j]>'9')  break;
           else b[k]=b[k]*10+w[j]-'0';
       }

   int min=a[0],max=a[0];
   for(j=0;j<f;j++)
      {
          if(a[j]<min)  min=a[j];
          if(a[j]>max)   max=a[j];
      }
   for(j=0;j<f;j++)
      {
          if(b[j]<min)  min=b[j];
          if(b[j]>max)   max=b[j];
      }
   for(k=min;k<max;k++)
        {
            for(j=0;j<f;j++)
               {
                   if(a[j]<k&&k<b[j]) {c[k]++;}
                   else if(a[j]==k)  {c[k]++;}
               }

        }

    i=c[min];
    for(j=min+1;j<max;j++)
        {
            if(c[j]>i)  i=c[j];
        }

    printf("%d %d",f,i);
    }
int come[1000],out[1000];
int in();                  //??
int check(int max);        //??????
int search(int same[1000]);//???
int main()
{  int max;
  max=in();                //???????
  cout<<max+1<<" "<<check( max);//??
  return 0;
}
int in()
{int i=0,j=0;
	char a;
	while(true)
	{  cin>>come[i++];
		cin.get(a);   //????
		if(a=='\n')break;
	
		}
	i=0;
	
while(true)
	{  cin>>out[i++];
		cin.get(a);
		if(a=='\n')break;
	
		}
return i-1;
}
int check(int max)
{
	int i,j,k=0,same[1000]={0};
	for(i=0;i<=1000;i++)       //?????
	{for(j=0;j<=max;j++)
		if(i>=come[j]&&i<out[j])
			same[k]++;k++;}
	return search(same);

}
int search(int same[1000])
{
	int i,ma=0;
	for(i=0;i<1000;i++)
       if(ma<same[i])         //???
		   ma=same[i];
	return ma;
}
int main()
{
	char x[5000], y[5000];
	int xx[5000] = {0}, yy[5000] = {0}, t[5000] = {0},q[5000]={0};
	int i, j, ii, num, s, k, max = 0, min = 1200, most = 0, least = 1200, n1, kk, jj, n2;
	cin >> x;
	cin >> y;
	i = 0;
	num = 0;
	n1 = strlen(x);
	n2 = strlen(y);
	while (i < n1)
	{
		s = 1;
		num ++;
		ii = i;
		jj = 1;
		while ((x[ii] != ',') && (ii < n1))
		{
			q[jj] = x[ii] - '0';
			jj ++;
			ii ++;
		//	cout << xx[num]<< endl;
	
		}	
		for (kk = jj - 1; kk >= 1; kk--)
			{
				xx[num] += s * q[kk];
				s *= 10;
			}
	//	cout << xx[num]<< endl;
		if (xx[num] < min)
			min = xx[num];
		i = ii + 1;
		//cout << i << endl;
	}
	//cout << num << endl;
	i = 0;
	num = 0;
	while (i < n2)
	{
		s = 1;
		ii = i;
		num ++;
		jj = 1;
		while ((y[ii] != ',') && (ii < n2))
		{
			q[jj] = y[ii] - '0';
			jj ++;
			ii ++;
			
		}
		for (kk = jj - 1; kk >= 1; kk--)
			{
				yy[num] += s * q[kk];
				s *= 10;
			}
		if (yy[num] > max)
			max = yy[num];
		i = ii + 1;
	}
//	cout << num<< endl;
//	cout << min << " " << max << endl;
	//cout << i << endl;
	for (j = 1; j <= num; j++)
	{
		//cout << xx[j] << endl;
		for (k = xx[j]; k < yy[j]; k++){
			t[k] ++;}
	}
	for (k = min; k <= max; k++)
	{
		//cout << t[k] << endl;
		if (t[k] > most)
			most = t[k];
		if (t[k] < least)
			least = t[k];
	}
	cout << num  << " " << most << endl;

	return 0;
}
int main()
{
	int x[1000], y[1000];                             //????????
	int cnt = 0;
	int man[1000] = {0};
	int manmax = 0;
	int xmin, ymax;
	xmin = INT_MAX;                                   //???
	ymax = INT_MIN;
	char ch;
	for ( int q = 0; q <= 1000; q++ )                 //????????ch??","???
	{
		cin >> x[q];
		ch = cin.get();
		cnt++;                                        //?????
		if ( ch != ',' )
			break;
	}
	for ( int o = 0; o <= 1000; o++ )
	{
		cin >> y[o];
		ch = cin.get();
		if ( ch != ',' )
			break;
	}
	for ( int w = 0; w < cnt; w++ )                   //??????????
	{
		if ( x[w] <= xmin )
			xmin = x[w];
	}
	for ( int z = 0; z < cnt; z++ )                       //??????????
	{
		if ( y[z] >= ymax )
			ymax = y[z];
	}

	for ( int i = xmin; i < ymax; i++ )               //?????????????????
	{
		for ( int j = 0; j < cnt; j++ )
		{
			if( x[j] <= i && y[j] > i )
				man[i] ++;
		}
	}

	for ( int t = xmin; t < ymax; t++ )               //??????????????
	{
		if ( man[t] >= manmax )
			manmax = man[t];
	}
	cout << cnt << " " << manmax;
	return 0;
}
char a[100000], b[100000];
int power(int, int);
int main()
{
	int a1[1000], b1[1000], i, j, k, count, num = 0, n, m, time[1000], max = 0;
	memset(time, 0, sizeof(time));
	cin.getline(a, 100000);
	cin.getline(b, 100000);
	k = 0;
	count = 0;
	for(i = 0; ; i++)
	{
		if(a[i] == ',')
		{
			m = 0;
			n = count - 1;
			for(j = i - count; j < i; j++)
				m = m + (a[j] - '0') * power(10, n--);
			a1[k++] = m;
			num++;
			count = 0;
		}
		else if(a[i] == '\0')
		{
			m = 0;
			n = count - 1;
			for(j = i - count; j < i; j++)
				m = m + (a[j] - '0') * power(10, n--);
			a1[k++] = m;
			num++;
			break;
		}
		else count++;
	}
	k = 0;
	count = 0;
	for(i = 0; ; i++)
	{
		if(b[i] == ',')
		{
			m = 0;
			n = count - 1;
			for(j = i - count; j < i; j++)
				m = m + (b[j] - '0') * power(10, n--);
			b1[k++] = m;
			count = 0;
		}
		else if(b[i] == '\0')
		{
			m = 0;
			n = count - 1;
			for(j = i - count; j < i; j++)
				m = m + (b[j] - '0') * power(10, n--);
			b1[k++] = m;
			break;
		}
		else count++;
	}
	for(i = 0; i <= num; i++)
		for(j = a1[i]; j < b1[i]; j++)
			time[j]++;
	for(i = 0; i < 1000; i++)
	{
		if(time[i] > max)
			max = time[i];
	}
	cout << num << " " << max << endl;
	return 0;
}
int power(int i, int j)
{
	int k, m = 1;
	for(k = 0; k < j; k++)
		m = m * i;
	return m;
}
int main()
{
	int in[1001], out[1001], i, j, n, count[1001] = {0}, climax;
	char a;
	for (i = 0; ; i++)
	{
		cin >> in[i];
		cin.get(a);
		if (a == '\n')
			break;
	}
	for (i = 0; ; i++)
	{
		cin >> out[i];
		cin.get(a);
		if (a == '\n')
			break;
	}
	n = ++i;
	for (i = 0; i < n; i++)
	{
		for (j = in[i]; j < out[i]; j++)
			count[j]++;
	}
	climax = count[0];
	for (j = 0; j < 1000; j++)
		if (count[j] > climax)
			climax = count[j];
	cout << n << " " << climax << endl;
	return 0;
}
int main()
{
	int arrival[1000],depature[1000],i=0,j,count,max=0,t=0;
	char a[2000];
	while(true)
	{
		cin>>arrival[i];
		//cout<<arrival[i]<<' ';
		i++;
		if(cin.get()!=',')
			break;
	}
	//cout<<endl;
	int total=i;
	i=0;
	while(true)
	{
		cin>>depature[i];
		//cout<<depature[i]<<' ';
		i++;
		if(cin.get()!=',')
			break;
	}
	//cout<<endl;
	for(i=0;i<1000;i++)
	{
		count=0;
		for(j=0;j<total;j++)
			if(i>=arrival[j]&&i<depature[j])
				count++;
		if(count>max)
			{
			max=count;
			//cout<<"max="<<max<<' '<<"i="<<i<<endl;
			}
	}
	cout<<total<<' '<<max;
	return 0;
}



/*
cin.getline(a,2000);
	while(true)
	{
		char temp[20],time=0;
		memset(temp,0,sizeof(temp));
		for(;a[i]==',';i++)
		{
			if(a[i]=='\n')
			{
				letsBreak=true;
				arrival[t]=atof(temp);
				break;
			}
			temp[time]=a[i];
		}
		if(letsBreak)
			break;
		arrival[t]=atof(temp);
		i++;
		t++;
	}
	i=0,t=0;
	memset(a,0,sizeof(a));
	cin.getline(a,2000);
	while(true)
	{
		char temp[20],time=0;
		memset(temp,0,sizeof(temp));
		for(;a[i]==',';i++)
		{
			if(a[i]=='\n')
			{
				letsBreak=true;
				depature[t]=atof(temp);
				break;
			}
			temp[time]=a[i];
		}
		if(letsBreak)
			break;
		depature[t]=atof(temp);
		t++;
	}
	int total=t+1;
*/
//***********************
//??????????
//?????? 1300012849
//???2013?11?1?
//***********************
int main ()
{
    int sum = 0;                              //????????sum
    char c;                                   //??cin.get()??????c
    int i = 0 , j , p;
    int a[m];                              //????????????????????????????
    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[m];                               //??????d?????????????????d[0]??0?????????d[15]??15????????
   for ( i = 0; i < m; 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 < m; j++ )
       {
           if ( j >= a[i] && j < b[i] )
                d[j]++;
       }
   }
   int dmax = -9999;
    for(i = 0; i < m; i++)
    {
        if(dmax < d[i]) dmax = d[i];
    }
    /*
   for ( i = 1; i < m; i++ )               //??????d??????????????????????d[999]?????????????
   {
       for ( j = 0; j <= m - i; j++ )
       {
           if ( d[j] > d[j+1])
           {
                p = d[j+1];
                d[j+1] = d[j];
                d[j] = p;
           }
       }
   }
*/
   cout << sum << " "<< dmax << endl;
}
int main()
{
	int i,j,k,a[10000],b[10000],t=0,p[1000]={0},n,q;
	char c=',';
	for(i=0;c==',';i++)
	{
		scanf("%d",&a[i]);
		c=getchar();
	}
	for(j=0;j<i;j++)
	{
		scanf("%d",&b[j]);
		c=getchar();
	}
	printf("%d ",i);
	n=i;
	k=0;
	for(t=0;t<=999;t++)
	{
		for(i=0;i<n;i++)
		{
			if(a[i]<=t&&b[i]>=t+1)
				p[k]=p[k]+1;
			else;
		}
		k=k+1;
	}
	q=p[0];
	for(i=0;i<k;i++)
	{
		if(p[i]>q)
			q=p[i];
		else;
	}
	printf("%d",q);
	return 0;
}
///********************************
//*????????  **
//*?????? 1300012745 **
//*???2013.10.31  **
//********************************
int main()
{
	int a[1000]={0}, n=1, i, x, y, k, max;
	char ex;
	cin >> x;
	for (i=x; i<1000; i++)
		a[i]+=1;
	while ((ex=cin.get())==',')
	{
		cin>>x;
		n++;
		for (i=x;i<1000;i++)
			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++)
			a[i]--;
	}
	max=a[0];
	for (i=1;i<=999;i++)
		if(a[i]>max)
			max=a[i];
	cout<<n<<" "<<max;
	cin.get();cin.get();
	return 0;
}
int main()
{
    char in[5010];  //???? 
    char out[5010];  //???? 
    int num=0;   //??? 
    int x[1500];
    int y[1500];
    int time[1000];
    for(int i=0;i<1000;i++)
    {
        x[i]=0;
        y[i]=0;
        time[i]=0;
    }
    cin>>in>>out;
    int lenin=strlen(in);
    int lenout=strlen(out);
    in[lenin]=',';   out[lenout]=',';
    int p=lenin;   //???? 
    //cout<<p<<endl;
    int q=lenout;
    //cout<<q<<endl;
    int i=0;    //????  
    int k=0;
    while(p>=0)
    {
        if(in[p]==',')
        {
            i=p-1;
            {
                while(in[i]!=','&&i!=-1)
                {
                    x[k]=x[k]+(int)(in[i]-'0')*(int)(pow(10.0,(double)(p-1-i)));
                    i--;
                }
                p=i;
                k++;
            }
        }
    }
    k=0;
    while(q>=0)
    {
        if(out[q]==',')
        {
            i=q-1;
            {
                while(out[i]!=','&&i!=-1)
                {
                    y[k]=y[k]+(int)(out[i]-'0')*(int)(pow(10.0,(double)(q-1-i)));
                    i--;
                }
                q=i;
                k++;
            }
        }
    }
    num=k;   cout<<num<<" ";    // ?????? 
    /*
    for(i=0;i<num;i++)
    {
        cout<<x[i]<<" "<<y[i]<<endl;
    }
    */
    //????????????
    int maxe=0;
    for(i=0;i<1000;i++)
    {
        for(int j=0;j<k;j++)
        {
            if(i>=x[j]&&i<y[j])    time[i]++;
            
        }
        if(maxe<time[i])
        {
            maxe=time[i];
        }
        
    }
    cout<<maxe<<endl;
    return 0; 
       
}
int main()
{
    int x[1000],y[1000],i,n,t,count1,count=0;
    for(i=0;;i++)
    {
        scanf("%d",&x[i]);
        if(getchar()=='\n')
        {
            n=i+1;
            break;
        }
    }
    for(i=0;i<n;i++)
    {
        scanf("%d",&y[i]);
        if(i<n-1)
            scanf(",");    //????
    }
    for(i=0;i<n;i++)
       // printf("%d ",y[i]);
    for(t=0;t<1000;t++)
    {
        count1=0;
        for(i=0;i<n;i++)
            if((x[i]<=t)&&(y[i]>t))
            {
                count1++;
               // printf(" i=%d ",i);
            }
        if(count1>count)
            count=count1;
       // printf("%d\n",count1);
    }
    printf("%d %d",n,count);
    return 0;
}
void main()
{
 int a[1000],i=0,j=0;
 char d=',';
 while(d==',')
 {
  scanf("%d%c",&a[i],&d);
  i++;
 }
 int n=i,max=0;
 int b[n];
 i=0;
 while(i<n)
 {
  scanf("%d,",&b[i]);
  if(b[i]>max)
   max=b[i];
  i++;
 }
 int c[max];
 i=0;
 while(i<max)
 {
  c[i]=0;
  i++;
 }
 i=0;
 while(i<n)
 {
  j=a[i];
  while(j<b[i])
  {
   c[j]++;
   j++;
  }
  i++;
 }
 i=0;
 int m=0;
 while(i<max)
 {
  if(c[i]>m)
   m=c[i];
  i++;
 }
 printf("%d %d",n,m);
}
void main()
{
	int x[1010]={0},y[1010]={0},i=0,a=0,k=0,b=0,j,g[1010]={0},max;
	char str1[100000],str2[100000];
	scanf("%s",str1);
	while(str1[i]!='\0')
	{
		if(str1[i]!=',')
		x[a]=str1[i]-'0'+x[a]*10;
		else a++;
		i++;
	}
	i=0;
	scanf("%s",str2);
	while(str2[i]!='\0')
	{
		if(str2[i]!=',')
		y[b]=str2[i]-'0'+y[b]*10;
		else b++;
		i++;
	}
	printf("%d ",a+1);

for(i=0;i<a+1;i++)
    for(j=x[i];j<y[i];j++)
		g[j]++;

  max=g[0];
	for(i=0;i<1010;i++)
   if(g[i]>max)
	   max=g[i];
	printf("%d",max);
}
int main()
{
    char input[4000], comma;
    int enter[1000], leave[1000];
    cin >> input;
    int len = strlen(input), i, j, k, u = 0, min = 1000, max = 0;

    for (i = 0; i < len; i++) {
        if (input[i] != ',') {
            char temp[2000];
            k = 0;
            for (j = i; input[j] >= '0' && input[j] <= '9'; j++, k++) temp[k] = input[j]; temp[k] = '\0';
            enter[u] = atoi(temp);
            if (enter[u] < min) min = enter[u];
            i = j;
            u++;
        }
    }

    len = u;
    for (i = 0; i < len - 1; i++) {
        cin >> leave[i] >> comma;
        if (leave[i] > max) max = leave[i];
    }
    cin >> leave[len - 1];
    if (leave[len - 1] > max) {
        max = leave[len - 1];
    }

    int num[1000];
    for (i = min; i < max; i++) {
        for (j = 0; j < len; j++) {
            if (i >= enter[j] && i < leave[j]) num[i]++;
        }
    }

    int maxans = num[min];
    for (i = min; i < max; i++) {
        if (num[i] > maxans) maxans = num[i];
    }
    cout << len << " " << maxans << endl;
    return 0;
}
/*
 * main.cpp
 *
 *  Created on: 2012-11-16
 *      Author: ??
 *      ?????
 */


int main()
{
	char str1[5000],str2[5000];
	int a[1010][3];
	int k1=0,k2=0,l1,x,y,s=0,max=0,i,l2,t,j,m1=0,m2=2000;

	cin>>str1>>str2;l1=strlen(str1);l2=strlen(str2);
	while (k1<l1)
	{
        x=0;y=0;s++;
		while ((str1[k1]!=',')&&(k1<l1)) {x=x*10+str1[k1]-48;k1++;}
		while ((str2[k2]!=',')&&(k2<l2)) {y=y*10+str2[k2]-48;k2++;}
        a[s][1]=x;a[s][2]=y;
        if (m1>x) x=m1; if(m2<y) y=m2;
		k1++;k2++;
	}
    cout<<s<<' ';
	for (i=m1;i<=m2;i++)
	{
		t=0;

		for (j=1;j<=s;j++)
			if ((a[j][1]<=i)&&(a[j][2]>i)) t++;
		if (t>max) max=t;
	}
	cout<<max<<endl;
	return 0;
}