semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
void main()
{
	char a[10000]={0},b[10000]={0};
	int n=1,t=0,r,k=0,alen,blen,j,i,atime[10000],btime[10000],time[1000];
	gets(a);
	gets(b);
	alen=strlen(a);
	blen=strlen(b);
	for(i=0;i<10000;i++)
	{
		atime[i]=0;
		btime[i]=0;}
for(i=0;i<1000;i++)
	{
		time[i]=0;
		}
	for(i=0;i<alen;i++)
	{
		if(a[i]==',')
		{
			k=k+1;
			n=n+1;
		}
		else
		{
		
			atime[k]=atime[k]*10+(a[i]-'0');
		}

	}
	k=0;
	for(i=0;i<blen;i++)
	{
		if(b[i]==',')
		{
			k=k+1;
		
		}
		else
		{
		
			btime[k]=btime[k]*10+(b[i]-'0');
		}

	}

	for(i=0;i<1000;i++)
	{
		for(j=0;j<k+1;j++)
		{
			if(atime[j]<=i&&btime[j]>i)
		time[i]=time[i]+1;
		}
	}
	for(i=0;i<1000;i++)
		for(j=i;j<999-i;j++)
			if(time[j]>time[j+1])
			{
				t=time[j];
				time[j]=time[j+1];
				time[j+1]=t;
			}
			printf("%d %d",n,time[999]);

}
/*
 * ?????.cpp
 *
 *  Created on: 2010-12-29
 *      Author: wangwei
 */
int x[2000], y[2000];
char temp[2000];
//????????????
int input(int a[])
{
	int i,j=0;
	for(i=0;;i++)
	{
		cin>>a[i];
		temp[i]=cin.get();
		j++;
		if(temp[i]=='\n')
			break;
	}
	return j;
}
int main()
{
	int i,j,k,max,count[2000]={0};
	//????
	j=input(x);
	j=input(y);
	max=0;
	//???????
	for(i=0;i<=1000;i++)
	{
		for(k=0;k<j;k++)
		{
			if(x[k]<=i&&y[k]>i)
				count[i]++;
		}
		//????????????
		if(count[i]>max)
			max=count[i];
	}
	//???????????
	cout<<j<<" "<<max<<endl;
	return 0;
}
int a[1001],b[1001],n=1,m=1;
int k[1001]={0};
char c;
void scan()
{
	scanf("%d",&a[0]);
	while(1)
	{
		scanf("%c",&c);
		if(c==',')
		{
			scanf("%d",&a[n]);
			n++;
		}
		else 
			break;
	}
	scanf("%d",&b[0]);
	while(1)
	{
		scanf("%c",&c);
		if(c==',')
		{
			scanf("%d",&b[m]);
			m++;
		}
		else 
			break;
	}
}
void main()
{
	int i,l;
	scan();
	for(i=0;i<=1000;i++)
	{
		for(l=0;l<n;l++)
		{
			if((i>=a[l])&&i<b[l])
				k[i]++;
		}
	}
	l=k[0];
	for(i=0;i<=1000;i++)
	{
		l=l>k[i]?l:k[i];
	}
	printf("%d %d",n,l);
}
void main()
{
	int i;
	char c;
	int k;
	int a[1001],b[1001];
    k=1;
	scanf("%d",&a[k]);
	while((c=getchar())==',')
	{
		k++;
		scanf("%d",&a[k]);
	}
	k=1;
	scanf("%d",&b[k]);
	while((c=getchar())==',')
	{
		k++;
		scanf("%d",&b[k]);
	}
	printf("%d ",k);
	int t=0;
	for (i=0;i<=1000;i++)
	{
		int j;
		int sum=0;
		for (j=1;j<=k;j++)
			if (a[j]<=i && b[j]>i)
				sum++;
		if (t<sum)
			t=sum;
	}
	printf("%d",t);
}
int main()
{
	int a[1111],b[1111],m[1110]={0},n,w,max=0,j,i=-1;
	char c=',';
	while (c==',')
	{
		i++;
		scanf("%d",&a[i]);
		c=getchar();
	}
	w=i+1;
	c=',';
	i=-1;
	while (c==',')
	{
		i++;
		scanf("%d",&b[i]);
		c=getchar();
	}	
	for (n=0;n<=999;n++)
	{
		for (j=0;j<=i;j++)
		{
			if ((n>=a[j])&&(n<b[j]))
				m[n]++;
		}
	}
	for (n=0;n<=999;n++)
	{
		if (m[n]>max)
			max=m[n];
	}
	printf("%d ",w);
	printf("%d\n",max);
}
//*********************************
//* ????????              *
//* ?????                    *
//* ???12?25?                *
//*********************************
int main()
{
	int x[1001]={0},y[1001]={0};
	int total=0,n=0;
	char ch=0;
	int time[1001]={0};
	int i,j;
	do
	{
		cin>>n;
		cin.get(ch);
		x[total]=n;//x?????
		total++;//total??????
	}while(ch==',');
	total=0;
	do
	{
		cin>>n;
		cin.get(ch);
		y[total]=n;//y?????
		total++;
	}while(ch==',');
	cout<<total<<" ";
	for(i=0;i<total;i++)
		for(j=x[i];j<y[i];j++)
			time[j]++;//time??????????
	int t=0;
	for(i=0;i<1001;i++)
		if(time[i]>t)
			t=time[i];//????
	cout<<t;
	return 0;
}
/**
 *@ file    1000012834_007homework.cpp
 *@ author  ???
 *@ date    2010-11-26
 *@ description 
 *          ????????????
 */
int num, minn = 5000, maxx = 0;
void trans(int num1[],char str[5000])
{
	int len, i, ii, jj, kk, s;
	int q[5000];
	len = strlen(str);
	i = 0;
	num = 0;
	while (i < len)
	{
		s = 1;
		num ++;
		ii = i;
		jj = 1;
		while ((str[ii] != ',') && (ii < len))
		{
			q[jj] = str[ii] - '0';
			jj ++;
			ii ++;	
		}	
		for (kk = jj - 1; kk >= 1; kk--)
			{
				num1[num] += s * q[kk];
				s *= 10;
			}
		if (num1[num] < minn)
			minn = num1[num];
		if (num1[num] > maxx)
			maxx = num1[num];
		i = ii + 1;
	}
}
int main()
{
	char x[5000], y[5000];
	int xx[5000] = {0}, yy[5000] = {0}, t[5000] = {0};
	int j, k, ii, s ,most = 0;
	cin >> x;
	cin >> y;
		trans(xx,x);
		trans(yy,y);
	/*i = 0;
	num = 0;
	while (x[i] != 0)
	{
		s = 1;
		ii = i;
		num ++;
		while (x[ii] != ',')
		{
			xx[num / 2 + 1] += s * (x[ii] - '0');
			s *= 10;
			ii ++;
		}
			//cout << xx[i / 2 + 1]<< endl;
		if (xx[num / 2 + 1] < min)
			min = xx[num / 2 + 1];
		}
		i = ii;
	}
	i = 0;
	num = 0;
	s = 1;
	while (y[i] != 0)
	{
		ii = i;
		s = 1;
		num ++;
		while (y[ii] != ',')
		{
			yy[num / 2 + 1] += s * (y[ii] - '0');
			s *= 10;
			ii ++;
		}
			if (yy[num / 2 + 1] > max)
			max = yy[num / 2 + 1];
		i = ii;
	}*/
	
for (j = 1; j <= num; j++)
	{
		for (k = xx[j]; k < yy[j]; k++)
			t[k] ++;
	}
	for (k = minn; k <= maxx; k++)
	{
		//cout << t[k] << endl;
		if (t[k] > most)
			most = t[k];
	}
	cout << num  << " " << most << endl;

	return 0;
}
int bb[1000];
int main(){
    int k,x,y,z,a=0,time,i,j,aa[2000];
    char p;
    while(1){
     cin>>time;
     bb[time]++;
     if(cin.get()!=',')
     break;
     }
     i=0;
    while(1){
     cin>>time;
     bb[time]--;
     i++;
     if(cin.get()!=',')
     break;
     }
            x=0;
     for(j=0;j<999;j++){
           a=0;
       for(k=0;k<=j;k++){
              a=a+bb[k];
              }
        if(a>x){
        x=a;
        y=j;
        }
        }
        cout<<i<<" "<<x;
        return 0;
        }
//*****************************************
//* ???????? **
//* ?????? 1300012741 **
//* ???2013.10.30 **
//*****************************************


int main()
{
	int time_arrive[1000]; // ??????
	int time_leave[1000]; // ??????
	int people_present[1000] = { 0 }, people_max = 0; // ???????????????
	int i, j, num = 0; // ????????????
	char mess = 0; // ??????

	while ( mess != '\n' )
	{
		cin >> time_arrive[num];
		num++;
		mess = cin.get();
	}

	for ( i = 0; i < num; i++ )
	{
		cin >> time_leave[i];
		for ( j = time_arrive[i]; j < time_leave[i]; j++ )
			people_present[j]++;
		mess = cin.get();
	}

	for ( i = 0; i < 1000; i++ )
		if ( people_max < people_present[i] )
			people_max = people_present[i];

	cout << num << " " << people_max;

	return 0;
}
/*Conversion from characters to numbers*/
void char2int (int *length, char *a, int* aa){
    int temp = 0, k = 0;
    for(int j=0; j<*length; ++j){
        if(a[j] == ','){
            temp = 0;
            ++k;
        }
        else
            aa[k] = 10 * aa[k] + a[j]-'0';
    }
}

int main(){
    char c, a[4*1000], b[4*1000];
    int aa[1000] ={0}, bb[1000] = {0}, stat[1000]={0};
    int i = 0, num = 0, length1 = 0, length2 = 0, maxindex=0, in, out;
    while(scanf("%c",&c)!=EOF && c!='\n'){
        a[i++] = c;
        ++length1;
        if(c == ',')
            ++num;
    }
    i = 0;
    while(scanf("%c",&c)!=EOF && c!='\n'){
        b[i++] = c;
        ++length2;
    }
    char2int(&length1, a, aa);
    char2int(&length2, b, bb);
    ++num;
    for(int i=0; i<num; ++i){
        in = aa[i];
        out = bb[i];
        for(int j=in; j<out; ++j)
            ++stat[j];
    }
    for(int i=0; i<1000; ++i)
        if(stat[i] > stat[maxindex])
            maxindex = i;
    cout << num << " " << stat[maxindex] << endl;
    return 0;
}
//---------------
//   ?????
//   2010/12/22
//     ADE
//---------------


int get(int arr[1000])//?????????????
{
	int t=0,i=0;
	char c;
	while((c=cin.get())!='\n')
	{
		if(c!=',')
			t=t*10+c-'0';
		else 
		{
			arr[i]=t;
			t=0;
			i++;
		}
	}
	arr[i]=t;
	i++;
	return i;//?????
}
int main()
{
	int i,k,s[1000],e[1000],time[1000],num,max=0,endtime=0;//max???????endtime??????
	for(i=0;i<1000;i++)
		s[i]=e[i]=time[i]=0;
	num=get(s);
	num=get(e);
	for(i=0;i<num;i++)
	{
		if(endtime<e[i])endtime=e[i];  //??????
		for(k=s[i];k<e[i];k++)  //?i?????????????+1
			time[k]++;
	}
	for(i=0;i<endtime;i++)
		if(max<time[i])
			max=time[i];
	cout<<num<<" "<<max;
	return 0;
}
int main()
{

	char s[4000];
	int a[1001],b[1001],i=0,j=0,num=0,t1=2000,t2=0;
	memset(s,'\0',sizeof(s));
	cin.getline(s,4000);
	for(i=0;i<strlen(s);i++)
	{
		if(s[i]!=',')
		{
			num=num*10+s[i]-'0';
		}
		else{
			a[j]=num;
			if(t1>a[j]) t1=a[j];
			num=0;j++;
		}
	}
	a[j]=num;
				if(t1>a[j]) t1=a[j];
				num=0;
				j=0;
   cin.getline(s,4000);
   for(i=0;i<strlen(s);i++)
   	{
   		if(s[i]!=',')
   		{
   			num=num*10+s[i]-'0';
   		}
   		else{
   			b[j]=num;
   			if(t2<b[j]) t2=b[j];
   			num=0;j++;
   		}
   	}
   	b[j]=num;
   				if(t2<b[j]) t2=b[j];
   				num=0;
   int ren=0;
   double d=t1+0.5;
  while(d<t2)
   {int cou=0;
       for(int p=0;p<=j;p++)
    	   if(d>a[p]&&d<b[p])
    		   cou++;

       if(cou>ren) ren=cou;
       d+=1;
   }
   cout<<j+1<<" "<<ren;
   return 0;
}
int main()
{
	int i=0,j=0,k=0,n=0,m=0,a[10000]={0},d[1000][2],c[5]={1,10,100,1000,10000};
	char b,e[6]={0};
	for(;;)
	{
		b=getchar();
		i=0;
		m=0;
		for(;;i++)
		{
			if(b==','||b=='\n') break;
			e[i]=b;
			b=getchar();
		}
		for(k=i-1;k>=0;k--)
			m=m+(e[k]-'0')*c[i-1-k];
		n++;
		d[j++][0]=m;
		if(b=='\n') break;
	}
	j=0;
	for(;;)
	{
		b=getchar();
		i=0;
		m=0;
			for(;;i++)
		{
			if(b==','||b=='\n') break;
			e[i]=b;
			b=getchar();
		}
		for(k=i-1;k>=0;k--)
			m=m+(e[k]-'0')*c[i-1-k];
		d[j++][1]=m;
		if(b=='\n') break;
	}
	printf("%d ",n);
	for(i=0;i<n;i++)
		for(j=d[i][0];j<d[i][1];j++)
			a[j]++;
	m=0;
	for(i=0;i<10000;i++)
        if(a[i]>m) m=a[i];
	printf("%d",m);
}
/*
 * wanyi.cpp
 *
 *  Created on: 2012-11-10
 *      Author: 7
 */
int main()
{
	int x[1000];
	int y[1000];
	char a;
	int i=0,j,num=0,max=0,n,minx=10000,maxy=0;
	while(cin>>x[i])
	{
		if(x[i]<minx)
			minx=x[i];
		i++;
		cin.get(a);
		if(a=='\n')
			break;
	}
	n=i;
	i=0;
	while(cin>>y[i])
		{
		if(y[i]>maxy)
			maxy=y[i];
			i++;
			cin.get(a);
			if(a=='\n'||i>n)
				break;
		}
	for(i=minx;i<maxy;i++)
	{
		for(j=0;j<n;j++)
		{
			if(i>=x[j]&&i<y[j])
			{
				num++;
				if(num>max)
					max=num;
			}
		}
		num=0;
	}
	cout<<n<<" "<<max;
}
int main()
{
	int a[1001]={0},b[1001]={0};//???????
	int i=1,count,max1=INT_MIN,min1=INT_MAX,MAX=0,total=0;//??????????????
	while(1)//?????????? ????
	{
		scanf("%d", &a[i++]);
		char c = cin.get();
		if(c=='\n')
		{
			count=i;
			break;
		}
	}
	i=1;
	while(1)
	{
		scanf("%d", &b[i++]);
		char c = getchar();
		if(c=='\n')break;
	}
	count=i-1;
	for(int j=1;j<=count;j++)
		min1=min1>=a[j]?a[j]:min1;
	for(int j=1;j<=count;j++)
		max1=max1<=b[j]?b[j]:max1;
	for(int l=min1;l<=max1;l++)
	{
		for(int k=1;k<=count;k++)
		{
			if(a[k]==l)
			{
				total++;
			}
			if(b[k]==l)
			{
				total--;
			}

		}
		MAX=MAX>=total?MAX:total;
	}

	cout<<count<<" "<<MAX<<endl;
	return 0;
}
//****************************
//**Title:?????        **
//**Author:?? 1300012732  **
//**Date?2013.10.30        **
//**File?4.cpp             **
//****************************
int main()
{
	int a[1000];
	int b[1000];
	char ch;
	int i;
	for (i = 0; ;i++)
	{
		cin >> a[i];
		ch = cin.get();
		if (ch == 10)
			break;
	}
	int max = 0;
	for (i = 0; ;i++)
	{
		cin >> b[i];
		if (b[i] > max)
			max = b[i];
		ch = cin.get();
		if (ch == 10)
			break;
	}
	cout << i + 1 << ' ';
	int j, k, htime = 0;
	for (j = 0; j <= max; j++)
	{
		int cnt = 0;
		for (k = 0; k <= i; k++)
		{
			if (a[k] <= j && b[k] > j)
				cnt++;
		}
		if (cnt > htime)
			htime = cnt;
	}
	cout << htime << endl;
	return 0;
}
char s[4000],t[4000];
int a[3000]={0},b[3000]={0},h[1008]={0};
void main()
{
	int i,k,n1,n2;
	gets(s);gets(t);
	n1=strlen(s);
	k=0;
	for(i=0;i<n1;i++)
	{
		
		if(s[i]!=',')
		{
			a[k]=a[k]*10+s[i]-'0';
		}
		else k++;
	}
	n2=strlen(t);
	k=0;
	for(i=0;i<n2;i++)
	{
		
		if(t[i]!=',')
		{
			b[k]=b[k]*10+t[i]-'0';
		}
		else k++;
	}
	printf("%d ",k+1);
	int j;
	for(i=0;i<k+1;i++)
	{
		for(j=a[i];j<b[i];j++)
			h[j]++;
	}
	int y=0;
	for(i=0;i<1000;i++)
		if(h[i]>=y)	y=h[i];
	printf("%d\n",y);
}
int main()
{
	char come[110000],go[110000];
	cin.getline(come,110000);
	cin.getline(go,110000);
	int x=1,i,j=1;
	int people=1,size=strlen(come);
	for(i=0;i<size;i++)
		if(come[i]==',')
		  people++;
		cout<<people;
	int come1[1000],go1[1000];
	come1[0]=atoi(come);
	for(i=0;i<size;i++)
		if(come[i]==',')
		{
			come1[j]=atoi(come+i+1);
			j++;
		}
	j=1;
	size=strlen(go);
	go1[0]=atoi(go);
	for(i=0;i<size;i++)
		if(go[i]==',')
		{
			go1[j]=atoi(go+i+1);
			j++;
		}
	int max=0;
	for(i=0;i<=1000;i++)
	{
		int number=0;
		for(j=0;j<people;j++)
		{
			if(i>=come1[j]&&i<go1[j])
				number++;
		}
		if(number>max)
			max=number;
	}

	cout<<' '<<max;
	return 0;

}
/*
@file 1000012837_7.cpp
@author ???
@date 2010-11-26
@description ?????
*/
int main()
{
	int i = 0, j = 0, p, come[1000], go[1000], time[1001] = {0}, line = 1, tmax = 0, pmax = 0;
	char c;
	while(1)
	{
		if(line == 1)				//?????
		{
			cin >> come[i++];		//??????come[]
			c = cin.get();			//???????
			if( c == '\n')			//????????line++
				line++;
		}
		else if(line == 2)		//??????
		{
			cin >> go[j++];		//??????go[]
			c = cin.get();		//???????
			if(go[j - 1] > tmax)	//????????
			{
				tmax = go[j - 1];
			}
			if( c == '\n')		//????????line++
				line++;
		}
		else break;				//??line??1?2??????????
	}
	p = i;						//????come??????
	//????????????????????
	for(i = 0; i < p; i ++)
	{
		for(j = come[i]; j < go[i]; j++)
		{
			time[j]++;	
		}
	}
	//?????????????
	for(i = 0; i <= tmax; i++)
	{
		if(time[i] > pmax)
		{
			pmax = time[i];
		}
	}
	cout << p << " " << pmax << endl; //??????????????????
	return 0;
}
struct ren
{
	int x;
	int y;
}a[1010];
int main()
{
    char c;
	int i=1,j,n,min=2000,max=0,t,d;
	do
	{
		scanf("%d%c",&a[i].x,&c);
		i++;
	}while(c==',');
	n=i-1;
	i=1;
	do
	{
		scanf("%d%c",&a[i].y,&c);
		i++;
	}while(c==',');
	printf("%d ",n);
	for(i=1;i<=n;i++)
	{
		if(a[i].x<min)
			min=a[i].x;
	}
	for(i=1;i<=n;i++)
	{
		if(a[i].y>max)
			max=a[i].y;
	}
	for(i=min,t=0;i<=max-1;i++)
	{
        for(j=1,d=0;j<=n;j++)
		{
			if(a[j].x<=i&&a[j].y>=i+1)
				d++;
		}
        if(d>t)
			t=d;
	}
    printf("%d",t);
	return 0;
}
int deal(char a[],int ans[])
{
	int i,j=0;
	ans[0]=0;
	for(i=0;;i++)
	{
		if(a[i]=='\0') break;
		if(a[i]==',') {j++;ans[j]=0;}
		else ans[j]=ans[j]*10+a[i]-'0';
	}
	return j+1;
}
void main()
{
	char a[4000],b[4000];
	int aa[1000],bb[1000];
	int t[1000],i,j,max=0,n;
	gets(a);
	gets(b);
	for(i=0;i<1000;i++) t[i]=0;
	deal(a,aa);
	n=deal(b,bb);
	for(i=0;i<n;i++)
		for(j=aa[i];j<bb[i];j++)
			t[j]++;
	for(i=0;i<1000;i++) if(t[i]>max) max=t[i];
	printf("%d %d",n,max);
}
/*?????
  ????????
*/

int main(){
	int x[1000]={0},y[1000]={0},s[1001]={0},i=0,j=0;    //x,y?????????s??????
	char c;
	while(1)
	{cin>>x[i];i++;if((c=getchar())=='\n')break;}
	while(1)
	{cin>>y[j];j++;if((c=getchar())=='\n')break;}//??
	for(int m=0;m<i;m++){
		for(int n=x[m];n<y[m];n++){
			s[n]+=1;}              //??????
	}
	int max=0;
	for(int p=0;p<1000;p++){if(max<s[p])max=s[p];}
	cout<<i<<' '<<max;      //??
return 0;}
int main()
{
	int start[1000], end[1000], num = 0, i, j, max = 0, total;
	char c;
	for(num = 1; cin >> start[num - 1], (c = cin.peek() == ','); cin >> c, num++)
		;
	cin >> end[0];
	for(i = 1; i < num; i++)
		cin >> c >> end[i];
	for(i = 0; i < 1000; i++)
	{
		total = 0;
		for(j = 0; j < num; j++)
			if(start[j] <= i && i < end[j])
				total++;
		if(total > max)
			max = total;
	}
	cout << num << ' ' << max;
	return 0;
}
//********************************
//*???????? **
//*?????1300062805 **
//*???2013.11.2 **
//********************************
int a[1001];
int main()
{
	int i, x, y, k = 1, j = 0, sum = 0;
    for(i = 1; ;i ++)             // ??????????????????  
    {   
        cin >> x;
        a[x]++;
        if( cin.get()!= ',')
       {
          k = i;                 //?????? 
          break;       
       }   
    }     
       for(i = 1; ;i ++)         // ?????????????????? 
    {   
        cin >> y;
        a[y]--;
      if( cin.get()!= ',')
       {
          break;       
       }   
    }     
      for(i = 0; i <= 1000; i++)  //????????????????????? 
      { 
		sum = sum + a[i];
        if(sum >= j)
        {
          j = sum ;     
		}
        
      }              
        cout << k <<" "<< j << endl;//?????????????????? 
       return 0;
}
int change(char a[100])
{
 int i,l,s;
 l=strlen(a);
 s=0;
 for(i=0;i<l;i++)
 {
  s=s*10+a[i]-'0';
 }
 return(s);
}
int main()
{
 char a[5000];
 char b[5000];
 char s[10];
 int c[2][1000]={0};
 int t[1000]={0};
 int l,i,j,k,t1,t2,x,m;
 gets(a);
 gets(b);
 l=strlen(a);
 j=0;
 k=0;
 for(i=0;i<l;i++)
 {
  if(a[i]!=',')
  {
   s[j]=a[i];
   j++;
  }
  else
  {
   s[j]='\0';
   c[0][k]=change(s);
   s[0]='\0';
   j=0;
   k++;
  }
 }
 s[j]='\0';
 c[0][k]=change(s);
 s[0]='\0';
 l=strlen(b);
 j=0;
 k=0;
 for(i=0;i<l;i++)
 {
  if(b[i]!=',')
  {
   s[j]=b[i];
   j++;
  }
  else
  {
   s[j]='\0';
   c[1][k]=change(s);
   s[0]='\0';
   j=0;
   k++;
  }
 }
 s[j]='\0';
 c[1][k]=change(s);
 t1=c[0][0];
 for(i=1;i<=k;i++)
 {
  if(c[0][i]<t1)
   t1=c[0][i];
 }
 t2=c[1][0];
 for(i=1;i<=k;i++)
 {
  if(c[1][i]>t2)
   t2=c[1][i];
 }
 for(i=t1;i<t2;i++)
 {
  m=i-t1;
  for(j=0;j<=k;j++)
  {
   if(c[0][j]<=i&&c[1][j]>i)
    t[m]++;
  }
 }
 x=t[0];
 for(i=0;i<t2-t1;i++)
 {
  if(t[i]>x)
   x=t[i];
 }
 printf("%d %d",k+1,x);
 return 0;
}
int main()
{
	
	int a[1000]={0},b[1000]={0},i=0,j,kk=0,n,al,m=0,c[1000]={0},chang;
    while(1)
	{   
		cin>>a[i];
		i++;
		if(cin.get()!=',')
			break;
	}
	i=0;
	while(1)
	{   
		cin>>b[i];
		i++;
		if(cin.get()!=',')
			break;
	}
	chang=i-1;



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

	cout<<m+1<<" ";
	for(j=0;j<=999;j++)
		if(c[j]>c[0])

			c[0]=c[j];
	cout<<c[0];	
	return 0;
}
int max_people(int x[],int y[],int num)
{
	int i,j,max=0,temp;
	for(i=0;i<1000;i++)
	{   
		temp=0;
		for(j=0;j<num;j++)
		{
			if((i>=x[j])&&(i<y[j]))
				temp++;
		}
	
		if(temp>max)
			max=temp;
	}
	return max;
}


void main()
{
	int i,num=0,x[8000],y[8000];
	char c;
	do
	{
		scanf("%d%c",&x[num++],&c);
	}while(c!='\n');
	num=0;
	do
	{
		scanf("%d%c",&y[num++],&c);
	}while(c!='\n');
	printf("%d ",num);
	int max=max_people(x,y,num);
	printf("%d",max);
}
/***************************************************
?? ??? 1300017667
?? 20101031
?? ?????
***************************************************/
int main()
{
	int n = -1, i, t, man = 0, maxman = 0;
	char c;
	int start[1000], end[1000];						//???????????????
	do
	{
		n ++;
		cin >> start[n];
		c = cin.get();
	}while(c != '\n');								//???????????????????
	for(i = 0; i <= n; i ++)
	{
		cin >> end[i];
		cin.get();
	}
	for(t = 0; t <= 1000; t ++)
	{
		for(i = 0; i <= n; i ++)
		{
			if(t >= start[i] && t < end[i])			//????????
				man ++;
		}
		if(man > maxman)							//????????????????????????????????
			maxman = man;
		man = 0;
	}
	cout << n + 1 << " " << maxman;
	return 0;
}
int main()
{
	int n,x[10000],y[10000],i=1,j,k,people[1001]={0},mp=0;
	char t;
	cin>>x[0];
	cin.get(t);
	while(t!='\n')
	{
		cin>>x[i++];
		cin.get(t);
	}
	for(j=0;j<i;j++)
	{
		cin>>y[j];
		cin.get(t);
	}
	for(j=0;j<1000;j++)
	{
		for(k=0;k<=i;k++)
		{
			if(j>=x[k]&&j<y[k])
				people[j]++;
		}
		if(people[j]>mp)
			mp=people[j];
	}
	cout<<i<<' '<<mp;
	return 0;
}
void main()
{
int i,j,k,m=0,n,m1=0,m2=0,i1,i2,t;
int a[1000],b[1000];
static int c[1002];
char s[10000];

gets(s);
m=0;j=0;

for(i=0;s[i]!='\0';i++)
{
if(s[i]==','){a[j]=m;j++;m=0;}
else m=m*10+s[i]-'0';
}
a[j]=m;j++;

gets(s);
m=0;j=0;

for(i=0;s[i]!='\0';i++)
{
if(s[i]==','){b[j]=m;j++;m=0;}
else m=m*10+s[i]-'0';
}
b[j]=m;j++;m=0;

n=j;

m1=0;
for(i=0;i<n;i++)
{
for(j=a[i];j<b[i];j++)c[j]++;
}

for(i=0;i<1001;i++)
{
if(c[i]>m1) m1=c[i];
}

printf("%d %d\n",n,m1);


}
int main()
{
	int x[1000 + 10] = {0}, y[1000 + 10] = {0}, presence[1000 + 10] = {0};
	int digit, i, j, k, nperson = 0, finaltime = 0;
	char c;
	cin >> x[nperson ++];
	while ((c = cin.get()) != '\n')
	{
		if (c == ',')
		{
			cin >> digit;
			x[nperson] = digit;
			nperson ++;
		}
	}
	nperson = 0;
	cin >> y[nperson ++];
	while ((c = cin.get()) != '\n')
	{
		if (c == ',')
		{
			cin >> digit;
			y[nperson] = digit;
			nperson ++;
			finaltime = finaltime > digit ? finaltime : digit;
		}
	}
	//cout << nperson;
	//for (i = 0; i < nperson; i ++)
	//	cout << x[i] << " ";
	//cout << endl;
	//for (i = 0; i < nperson; i ++)
	//	cout << y[i] << " ";
	//cout << endl;

	for (i = 0; i < nperson; i ++)
	{
		for (j = x[i]; j <= y[i] - 1; j ++)
			presence[j] ++;
	}
	int maxperson = 0;
	for (i = 0; i < finaltime; i ++)
	{
		//cout << presence[i] << " ";
		maxperson = maxperson > presence[i] ? maxperson : presence[i];
	}
	//cout << endl;
	cout << nperson << " " << maxperson << endl;
	return 0;
}
int main()
{
int i,a[1000],b[1000],n=0,t,maxt=0,t1[1000]={0},max=0;
char c;
for(i=0;;i++)
{
    scanf("%d%c",&a[i],&c);
    n++;
    if(c!=',')
    break;
}
for(i=0;;i++)
{
    scanf("%d%c",&b[i],&c);
    if(b[i]>maxt)
    maxt=b[i];
    if(c!=',')
    break;
}
for(t=0;t<maxt;t++)
{
    for(i=0;i<n;i++)
    if((t>=a[i])&&(t<b[i]))
    t1[t]++;
}
for(t=0;t<maxt;t++)
    if(max<t1[t])
    max=t1[t];
    printf("%d %d",n,max);
return 0;
}
int main()
{
	char inp1[4000],inp2[4000];
	cin>>inp1>>inp2;

	int time1[1000],time2[1000];
	char temp[4];

	int pointer=0;
	int people=0;
	for(int k=0;inp1[k]!='\0';k++)
	{
		if(inp1[k]!=',')
		{
			temp[pointer++]=inp1[k];
		}
		else
		{
			temp[pointer]='\0';
			time1[people++]=atoi(temp);
			pointer=0;
		}
	}
	temp[pointer]='\0';
	time1[people++]=atoi(temp);
	
	pointer=0;
	people=0;
	for(int k=0;inp2[k]!='\0';k++)
	{
		if(inp2[k]!=',')
		{
			temp[pointer++]=inp2[k];
		}
		else
		{
			temp[pointer]='\0';
			time2[people++]=atoi(temp);
			pointer=0;
		}
	}
	temp[pointer]='\0';
	time2[people++]=atoi(temp);

	int max=0;
	for(int k=0;k!=1000;k++)
	{
		int counter=0;
		for(int i=0;i!=people;i++)
		{
			if(k>=time1[i]&&k<time2[i])
				counter++;
		}
		if(counter>max)
			max=counter;
	}
	cout<<people<<" "<<max<<endl;
	return 0;
}
int t1[1000]={0};
int t2[1000]={0};
int num=0,m=0;
void judge(int x);
int main()
{
	char start[10000];
	char end[10000];
	int i=0,k=0;
	cin.getline(start,10000);
	cin.getline(end,10000);
	while(start[i]!='\0')
	{
		if(start[i]==',') num++;
		i++;
	}
	num=num++;
	cout<<num<<' ';
	i=0;
	while(start[i]!='\0')
	{
		if(start[i]==',') 
		{
			k++;
		}
		else
		{
			t1[k]=10*t1[k]+(start[i]-'0');
		}
		i++;
	}
	i=0,k=0;
	while(end[i]!='\0')
	{
		if(end[i]==',') 
		{
			k++;
		}
		else
		{
			t2[k]=10*t2[k]+(end[i]-'0');
		}
		i++;
	}
	for(int j=0;j<1001;j++)
	{
		judge(j);
	}
	cout<<m;
	return 0;
}
void judge(int x)
{
	int count=0;
	for(int i=0;i<num;i++)
	{
		if(x>=t1[i]&&x<t2[i]) count++;
	}
	if(count>m) m=count;
}
int main( )
{
	int time,count=0,a[1001]={0},i;
	char b;
	while(1)
	{
		cin>>time;	
		a[time]++;
		count++;	
		if(cin.get()!=',')
			break;
	}	
	for(i=0;i<count;++i)	
	{
		cin>>time>>b;
		a[time]--;
	}
	int max=0,renshu=0;
	for(i=0;i<1001;++i)
	{
		renshu+=a[i];
		if(renshu>max)
			max=renshu;
	}
	cout<<count<<" "<<max;
	return 0;
}
//**********************************************************************************************
//* ??????????                                                                       *
//* ????????????????????????????????????????????? *
//*           ???????????????????????????????i?????????*
//*           ???????????xi, yi????????????????t?? xi <= t < yi? *
//*           ???????????????????? 0 <= xi < yi<1000??????????? *
//*           ??????????????????????????????                     *
//* ?    ?????                                                                           *
//* ?    ??2013.10.30                                                                       *
//**********************************************************************************************
int main()
{
	int t[1000]={0} , x[1000] , y[1000] , num , i  , c , max ;
	num = 0 ;
	do
	{
		cin >> x[num] ;
		num++ ;
	}
	while ( ( c = cin.get() ) == ',' ) ;                       //??xi????
	num = 0 ;
	do
	{
		cin >> y[num] ;
		num++ ;                                                //?????
	}
	while ( ( c = cin.get() ) == ',' ) ;                       //??yi????
	max = 0 ;

	for ( i = 0 ; i <= num - 1 ; i ++ )
	{
		for ( int j = x[i] ; j < y[i] ; j++ )
		{
			t[j]++ ;                                           //??????
			if ( t[j] > max )
				max = t[j] ;
		}
	}
	cout << num << " " << max ;
	return 0 ;
}