semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
//****************************************************** 
//* ? ? ?   ?? ? ? ? ?                        *
//* ? ?      ?? ? ?                              *
//* ? ? ? ??2010 ? 11 ? 24 ?                   * 
//* ? ?      ?1000010185                            *
//****************************************************** 
int main()
{
	char a[10000], b[10000];
	int x[5000], y[5000], k1[5000], k2[5000], p = 1, q = 1, k, la, lb;
	cin >> a >> b;

	//???????????????????????????
	la = strlen(a);
	lb = strlen(b);
	for (int i = 0; i < la; i ++) //????????
		if (a[i] == ',')
			k1[p ++] = i;
	for (int i = 0; i < lb; i ++)
		if (b[i] == ',')
			k2[q ++] = i;

	//?????????????k[i]?k[i+1]????????p=q
	k1[0] = -1;
	k2[0] = -1;
	k1[p] = la;
	k2[q] = lb;

	//??????????????
	for (int i = 0; i < p; i ++)
	{
		k = 1;
		for (int j = k1[i + 1] - 1; j >= k1[i] + 1; j --)
		{
			x[i] += (a[j] - '0') * k;
			k *= 10;
		}
		k = 1;
		for (int j = k2[i + 1] - 1; j >= k2[i] + 1; j --)
		{
			y[i] += (b[j] - '0') * k;
			k *= 10;
		}
	}
	for (int i = 0; i < p; i ++) //???????
		for (int j = 1; j < p - i; j ++)
			if (x[j - 1] > x[j])
			{
				k = x[j];
				x[j] = x[j - 1];
				x[j - 1] = k;
				k = y[j];
				y[j] = y[j - 1];
				y[j - 1] = k;
			}
	int max = 0, t[5000], sum;
	k = 1;
	t[0] = 0;
	for (int i = 0; i < p - 1; i ++) //???t???????????x????
		if (x[i + 1] != x[i])
			t[k ++] = i + 1;
	t[k] = p;
	max = t[1];

	//?????????????????
	for (int i = 1; i < k; i ++)
	{
		sum = t[i + 1] - t[i]; //????????????
		for (int j = 0; j < t[i]; j ++) //?????????????
			if (y[j] > x[t[i]])
				sum += 1;
		if (sum > max) //???????????
			max = sum;
	}
	cout << p << ' ' << max;
	return 0;
}
//*************************************************
//* ????1.cpp                                 *
//* ?? 1000012747                               *
//* ??????????????????          *
//*************************************************
int main()
{
	int n=0,i,j,temp=0;
	char cinx[100000],ciny[100000];  //cinx,ciny??????????
	int x[1000],y[1000],t[1000];     //x,y???????t?????????
	int len,lenx=0,leny=0,max=0,maxi;
	for(i=0;i<1000;i++)
	{
		x[i]=0;
		y[i]=0;
		t[i]=0;
	}
	cin.getline(cinx,100001,'\n');
	len=strlen(cinx);
	for(i=0;i<100000;i++)
		if(cinx[i]==',')
			n++;
	n++;                          //??????????
	for(i=0;i<len;i++)
	{
		if(cinx[i]!=',')
			lenx++;
		else
		{
			for(j=lenx-1;j>=0;j--)
			{
				x[temp]=x[temp]+((int)(cinx[i-j-1]-'0'))*(pow(10.0,j));  //????????????
			}
			lenx=0;
			temp++;
		}
	}
	j=0;
	for(i=0;i<len;i++)          //?????????????
	{
		if(cinx[i]==',')
			j++;
		if(j==n-1)
			break;
	}
	lenx=len-i-1;
	for(j=lenx-1;j>=0;j--)
		x[temp]=x[temp]+((int)(cinx[len-j-1]-'0'))*(pow(10.0,j));   //???????
	cin.getline(ciny,100001,'\n');
	len=strlen(ciny);
	temp=0;
	for(i=0;i<len;i++)
	{
		if(ciny[i]!=',')
			leny++;
		else
		{
			for(j=leny-1;j>=0;j--)
			{
				y[temp]=y[temp]+((int)(ciny[i-j-1]-'0'))*(pow(10.0,j));
			}
			leny=0;
			temp++;
		}
	}
	j=0;
	for(i=0;i<len;i++)
	{
		if(ciny[i]==',')
			j++;
		if(j==n-1)
			break;
	}
	leny=len-i-1;
	for(j=leny-1;j>=0;j--)
		y[temp]=y[temp]+((int)(ciny[len-j-1]-'0'))*(pow(10.0,j));
	for(i=0;i<n;i++)
		for(j=0;j<1000;j++)
			if((j>=x[i])&&(j<y[i]))
				t[j]++;                   //?????????
	for(i=0;i<1000;i++)
		if(t[i]>max)
		{
			maxi=i;
			max=t[i];                     //?????????
		}
	cout<<n<<" "<<max<<endl;
	return 0;
}
int main()
{
	int x[10000] = {0}, y[10000] = {0}, t[1000] = {0};
	int i, j, k, max;
	for (k = 0; ; k++)
	{
		cin >> x[k];
		if (cin.get() == '\n')
			break;
	}
	for (k = 0; ; k++)
	{
		cin >> y[k];
		if (cin.get() == '\n')
			break;
	}
	for (i = 0; i < 1000; i++)
		for (j = 0; j < k + 1; j++)
			if ((x[j] <= i) && (i < y[j]))
				t[i]++;
	max = 0;
	for (i = 1; i < 1000; i++)
		if (t[max] < t[i])
			max = i;
	cout << k + 1 << ' ' << t[max] << endl;
	return 0;
}
int main()
{
	int x, y, c = 0, max = 0;
	char r = 0;
	int a[1005] = {0};
	while (1)
	{
		cin >> x;
		for (int i = x; i <= 1001; i++)
		{
			a[i]++;
		}
		c++;
		if (cin.get() == '\n') break;
	}
	while (1)
	{
		cin >> y;
		for (int i = y; i <= 1001; i++)
		{
			a[i]--;
		}
		if (cin.get() == '\n') break;
	}
	for (int i = 1; i <= 1004; i++)
	{
		if (a[i] > max) max = a[i];
	}
	cout << c << " " << max << endl;
	return 0;
}
int main()
{
	int x[1000], y[1000], a[1000] = {0};
	int i, j, n = 0;
	char ch1, ch2;
	for (i = 0; ; i++)
	{
		cin >> x[i];
		ch1 = cin.get();
		n++;
		if (ch1 == '\n')
			break;
	}
	for (i = 0; ; i++)
	{
		cin >> y[i];
		ch2 = cin.get();
		if (ch2 == '\n')
			break;
	}
	int min;
	min = x[0];
	for (i = 0; i < n; i++)
		if (x[i] < min)
			min = x[i];
		int max;
		max = y[0];
		for (i = 0; i < n; i++)
			if (y[i] > max)
				max = y[i];
			for (j = min; j <= max; j++)
				for (i = 0; i < n; i++)
					if (x[i] <= j && y[i] > j)
						a[j]++;
					int m;
					m = a[min];
					for (i = min; i < max; i++)
						if (a[i] > m)
							m = a[i];
						cout << n << " " << m << endl;

						return 0;
}
//********************************
//*??  ?????          *****
//*????? 1300012753     ***** 
//*???2013.10.30          *****   
//********************************
int main()
{
	int a[1001], b[1001], i = 1, sum = 0, max = 0;   // a?????????b??????i????sum????????max?????? 
	char c;                                          // c????? 
	while (cin >> a[i])
	{
		c = cin.get();
		if(c != ',')
		break;
		i++;
	}
	cin >> b[1];
	for(int j = 2; j <= i; j++)
	{
		c = cin.get();
		cin >> b[j];
	}
	
	// ?????????k????????? 
	for (int k = 1; k <= i; k++)
	{
		for (int t = 1; t <= i; t++)
		{
			if(a[k] >= a[t] && a[k] < b[t])
			sum++;
		}
		
		// ???k?????sum????????????? 
		if(max < sum)
		max = sum;
		sum = 0;          //  sum????0 
	}
	cout << i << ' ' << max;
	return 0;
}
main()
{
	int x[1000]={0},y[1000]={0},t[1000]={0},n=0,i,j,k=1,max;
	char c;
	while((c=getchar())!='\n')
	{
		if(c>='0'&&c<='9')
			n=n*10+c-'0';
		else
		{
			x[k]=n;
			k++;
			n=0;
		}
	}
	x[k]=n;
	n=0;
	k=1;
	while((c=getchar())!='\n')
	{
		if(c>='0'&&c<='9')
			n=n*10+c-'0';
		else
		{
			y[k]=n;
			k++;
			n=0;
		}
	}
	y[k]=n;
	for(i=1;i<=k;i++)
	{
		for(j=x[i];j<y[i];j++)
			t[j]++;
	}
	max=t[0];
	for(i=1;i<999;i++)
	{
		if(t[i]>max)
			max=t[i];
	}
	printf("%d %d\n",k,max);
	return 0;
}
int main()
{
	int a[1000];
	int b[1000];
	char c;
	int i = 0 ,g =0, l = 0;
	do
	{
		cin >> a[i];
		c = cin.get();
		i ++;
	}while(c != '\n');
	for(int j =0;j <= i - 1;j ++)
	{
		cin >> b[j];
		cin.get();
	}
	for(int p = 1; p <= 1000; p ++)
	{
		for(int k =0; k <= i - 1; k ++)
		{
			if(p >= a[k] && p < b[k])
				g ++;
		}
		if(g >l)
			l = g;
		g = 0;
	}
	cout << i << " " << l;
	return 0;
}
int main()
{
	int x[1100],y[1100],i,n=0,max=0,min=1000,j,most=0,p;
	char b;
	do
	{
		scanf("%d",&x[n]);
		b=getchar();
		n++;
	}
	while(b==',');
	n=0;
    do
	{
		scanf("%d",&y[n]);
		b=getchar();
		n++;
	}
	while(b==',');
	printf("%d ",n);
	for(i=0;i<n;i++)
	{
		if(x[i]<min) min=x[i];
		if(y[i]>max) max=y[i];
	}

	for(i=min;i<max;i++)
	{
		p=0;
		for(j=0;j<n;j++)
			if(x[j]<=i&&y[j]>i) p++;
		if(p>most) most=p;
	}
	printf("%d\n",most);


}
int main()
{
    int temp;
    char m;
    int a[1001] = {0};
    int num;
    int i, j, k;
    int come[1000];
    int leave[1000];
    for(num = 0; ;num ++)
    {
          cin >> come[num];
          m = cin.get();
          if (m == '\n')
          break;
    }
    for(num = 0; ;num ++)
    {
          cin >> leave[num];
          m = cin.get();
          if (m == '\n')
          break;
    }
    for (i = 0; i <= num; i ++)
    {
         for(j = come[i]; j < leave[i]; j++)
         {
               a[j] ++;
         }
    }
    temp = a[0]; 
    for (i = 1;i <= 1000; i++)
    {
        if (a[i] >= temp)
        {
            temp = a[i];
        }
    }
    cout << num + 1<< " " << temp << endl;
    return 0;
}
int main()
{
	int total;
	int getin[1000];
	int getout[1000];
	int i=0,j=0;
	char x;
	do
	{
		cin>>getin[j];
		j++;
		x = getchar();
	}while(x==',');
	total = j;
	for(j=0;j<total;j++)
	{
		cin>>getout[j];
		x = getchar();
	}
	cout<<total<<" ";
    int people[2000];
	for(i=0;i<2000;i++)
	{
		people[i] = 0;
	}
	for(i=0;i<2000;i++)
	{
		for(j=0;j<total;j++)
		{
			if((i>=getin[j])&&(i<getout[j]))
			{
				people[i]++;
			}
		}
	}
	int max = 0;
	for(i=0;i<2000;i++)
	{
		if(people[i]>max)
			max = people[i];
	}
	cout<<max;
	return 0;
}
int x[1000];
int y[1000];
int main()
{
	char b;
	int num = 0, people, max = 0;
	for(; 1;)
	{
		b = cin.get();
		if ((b - '0' >= 0) && (b - '0' < 10))
		{
			x[num] *= 10;
			x[num] += b - '0';
		}
		if (b == ',')
		{
			num += 1;
		}
		if (b == '\n')
		{
			break;
		}
	}
	num = 0;
	for(; 1;)
	{
		b = cin.get();
		if ((b - '0' >= 0) && (b - '0' < 10))
		{
			y[num] *= 10;
			y[num] += b - '0';
		}
		if (b == ',')
		{
			num += 1;
		}
		if (b == '\n')
		{
			break;
		}
	}
	for (int i = 0; i < 1000; i++)
	{
		people = 0;
		for (int ii = 0; ii < num + 1; ii++)
		{
			if (i >= x[ii] && i < y[ii])
			{
				people += 1;
			}
			if (people > max)
			{
				max = people;
			}
		}
	}
	cout << num + 1 << ' ' << max;
	return 0;
}
void main()
{
	char c[5000];
	gets(c);
	int x[5000],y[5000],n=0,i=0,j=0,a[5000];
	for(i=0;i<5000;i++)
	{
		x[i]=0;
		y[i]=0;
		a[i]=0;
	}
	i=0;
	while(c[i]!=0)
	{
		if(c[i]!=',')
			x[n]=x[n]*10+c[i]-'0';
		else
			n++;
		i++;
	}
	gets(c);n=0;i=0;
	while(c[i]!=0)
	{
		if(c[i]!=',')
			y[n]=y[n]*10+c[i]-'0';
		else
			n++;
		i++;
	}
/*	printf("%d\n",n);
	for(i=0;i<=n;i++)
		printf("%d,%d ",x[i],y[i]);	*/						//????,n+1????
	for(i=0;i<1000;i++)
		for(j=0;j<=n;j++)
		{
			if(x[j]<=i&&y[j]>i)
					a[i]++;
		}
	int m=0;
	for(i=0;i<=1000;i++)
		if(a[i]>m)
			m=a[i];
	printf("%d %d",n+1,m);
//	for(i=0;i<=1000;i++)
//		printf(" %d  ",a[i]);
}
/*	puts(c);
	for(i=0;i<=n;i++)
		printf("%d,",a[i]);
		for(i=0;i<=n;i++)
			if(a[i]>k)
			{
				k=a[i];
			}
		for(i=0;i<=n;i++)
			if(a[i]==k)
				a[i]=0;
		k=0;
		for(i=0;i<=n;i++)
			if(a[i]!=0)
				break;
		if(i>n)printf("No");
		else
		{
		for(i=0;i<=n;i++)
		{
			if(a[i]>k)
				k=a[i];
		}
		printf("%d",k);
		}
}
*/
//???2010?11?24?
//???1000010586_???
//????????

int main()
{
	int start[1000] , end[1000];
	int i , j , k , num = 1 , max = 0 , min = 1000 , flag , M = 0;
	cin >> start[0];
         min = start[0];
	while ( cin.get() == ',' )
	{
		cin >> start[ num ];
		if ( start[ num ] < min )
			min = start[ num ];
		num ++;
	}
	cin >> end[0];
         max = end[0];
	for ( i = 1 ; i <= num - 1 ; i ++ )
	{
		cin.get();
		cin >> end[i];
		if ( end[i] > max )
			max = end[i];
	}
	for ( j = min ; j <= max - 1 ; j ++ )
	{
		flag = 0;
		for ( k = 0 ; k <= num - 1 ; k ++ )
		{
			if ( j >= start[k] && j < end[k] )
				flag ++;
		}
		if ( flag > M )
			M = flag;
	}
	cout << num << " " << M << endl;
	return 0;
}
int main()
{
	int x[1000],y[1000],t[1000];                      //??????
	char c[10000],d[10000],num[10000][10];            //??????
	char *p,*q;
	int s=0,m=0,n=0;
	int i,j;
	cin.getline(c,10000);
	p=c;q=num[s];
	while(1)
	{
		if(*p=='\0')                                  //??
		{
			*q='\0';
			s++;
			break;
		}
		if(*p==',')                                   //????
		{
			*q='\0';
			q=num[++s];
			p++;
		}
		else                                          //????
		{
			*q=*p; 
			p++;q++;
		}
	}
	for(i=0;i<s;i++)                                  //?????
	{
		x[i]=atol(num[i]);
	}
	s=0;
	cin.getline(d,10000);
	p=d;q=num[s];
	while(1)
	{
		if(*p=='\0')                                  //??
		{
			*q='\0';
			s++;
			break;
		}
		if(*p==',')                                   //????
		{
			*q='\0';
			q=num[++s];
			p++;
		}
		else                                          //????
		{
			*q=*p; 
			p++;q++;
		}
	}
	for(i=0;i<s;i++)                                  //?????
	{
		y[i]=atol(num[i]);
	}
	for(i=0;i<s;i++)                                  //??????
	{
		if(y[i]>m)m=y[i];
	}
	for(i=0;i<m;i++)                                  //?????
		t[i]=0;
	for(i=0;i<s;i++)                                  //???????+1
	{
		for(j=x[i];j<y[i];j++)
			t[j]++;
	}
	for(i=0;i<m;i++)                                  //??????
	{
		if(t[i]>n)n=t[i];
	}
	cout<<s<<" "<<n<<endl;
	return 0;
}
/**
* @file 1000012800_1.cpp
* @author ??
* @date 2010-11-24
* @description
* ??????:????? 
*/

int main()
{
	int count = 0, x[10000] = {0}, y[10000] = {0},time[1000] = {0}, n = 0, w = 0;
	char inputx[10000], inputy[10000];
	cin >> inputx >> inputy;
	for (int i = strlen(inputx) - 1; i >= 0; i --)
	{
		if(inputx[i] != ',')
		{
			x[n] += (inputx[i] - 48) * pow((double)10,w);
			w ++;
		}
		else
		{
			n ++;
			w = 0;
		}
	}
	w = 0;
	n = 0;
	for (int i = strlen(inputy) - 1; i >= 0; i --)
	{
		if(inputy[i] != ',')
		{
			y[n] += (inputy[i] - 48) * pow((double)10,w);
			w ++;
		}
		else
		{
			n ++;
			w = 0;
		}
	}
	for (int i = 0; i <= n; i ++)
		for(int j = x[i]; j < y[i]; j ++)
			time[j] ++;
	for(int i = 0; i < 1000; i ++)
	{
		if(time[i] > count)
			count = time[i];
	}
	cout << n + 1 << " " << count << endl;
		

	return 0;
}
int main()
{
	int count[1000]={0}, x[10000] = {0}, y[10000] = {0};
	int a, b, i=0, q=0, k, m, p, max;
	char ch;
	do
	{
		cin >> a;
		x[i] = a;
		i++;
		ch = cin.get();
	}while(ch==',');
	do
	{
		cin >> b;
		y[q] = b;
		q++;
		ch = cin.get();
	}while(ch==',');
	for(m=0; m<i; m++)
	{
		for(k=x[m]; k<y[m]; k++)
			count[k]++;
	}
	max = 0;
	for(p=0; p<1000; p++)
	{
		if(count[p] > max)
			max = count[p];
	}
	cout << i << ' ' << max << endl;
	return 0;
}
int a[1000],b[1000];
int main()
{
	char c;
	int n,i=0,j,MAX,t,min,max;
    while(1==1)
	{
		scanf("%d",&a[i]);
	    scanf("%c",&c);
		i=i+1;
		if(c!=',')
			break;
	}
	i=0;
	while(1==1)
	{
		scanf("%d",&b[i]);
	    scanf("%c",&c);
		i=i+1;
		if(c!=',')
			break;
	}
    n=i;
	min=a[0];
    for(i=0;i<n;i++)
	{
		if(a[i]<min)
			min=a[i];
	}
	max=b[0];
	for(i=0;i<n;i++)
	{
		if(b[i]>max)
			max=b[i];
	}
	MAX=0;
	for(i=min;i<max;i++)
	{
		t=0;
		for(j=0;j<n;j++)
		{
			if(b[j]>i && a[j]<=i)
				t++;
		}
		if(t>MAX)
			MAX=t;
	}
	printf("%d %d",n,MAX);
	return 0;
}
int min(int a[],int i)
{
	int m=a[0],j;
	for(j=0;j<i;j++)
		if(a[j]<m) m=a[j];
	return m;
}
int max(int a[],int i)
{
	int m=a[0],j;
	for(j=0;j<i;j++)
		if(a[j]>m) m=a[j];
	return m;
}

int main()
{
	int a[2][1001]={0};
	int i,j,start,end,k,m,p=0;
	char c;
	for(i=0;;i++)
	{
		scanf("%d",&a[0][i]);
		scanf("%c",&c);
		if(c=='\n') break;
	}i=i+1;
	for(j=0;j<i;j++)
		scanf("%d%c",&a[1][j],&c);
	start=min(a[0],i);
	end=max(a[1],i);
	for(k=start;k<=end;k++)
	{
		m=0;
		for(j=0;j<i;j++)
		{
			if(k<a[1][j]&&k>=a[0][j]) m=m+1;
		}
		if(m>p) p=m;
	}
	printf("%d %d",i,p);
	return 0;
}
int main()
{
	int a[1000];
	int i=1,n=1;
	scanf("%d",&a[0]);
	while(getchar()!='\n'){
		scanf("%d",&a[i]);
		i++;
		n++;
	}
	int b[1000];
	i=1;
	scanf("%d",&b[0]);
	while(getchar()!='\n'){
		scanf("%d",&b[i]);
		i++;
	}

	int j;
	int max=0;
	for(j=1;j<=1000;j++){
		int sum=0;
		for(i=0;i<n;i++){
			if(a[i]<=j&&b[i]>j){
				sum++;
			}
		}
		if(sum>max){
			max=sum;
		}
	}
	cout<<n<<" "<<max<<endl;
	return 0;
}
int main()
{
	char s[10001]={'\0'},t[10001]={'\0'};
	int a[1001]={0},b[1001]={0},c[1000]={0},i=1,j=0,m,n,k;
	gets(s);m=strlen(s);
	for(i=0;i<m;i++)
	{
		if(s[i]>='0'&&s[i]<='9')
			a[j]=a[j]*10+s[i]-48;
		else
			
               if(s[i-1]>='0'&&s[i-1]<='9')
			      j++;
	}
	
	if(s[m-1]>='0'&&s[m-1]<='9')
		m=j+1;
	else
		m=j;
	gets(t);n=strlen(t);j=0;
	for(i=0;i<n;i++)
	{
		if(t[i]>='0'&&t[i]<='9')
			b[j]=b[j]*10+t[i]-48;
		else
			
               if(t[i-1]>='0'&&t[i-1]<='9')
			      j++;
	}
	
	if(t[n-1]>='0'&&t[n-1]<='9')
		n=j+1;
	else
		n=j;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<n;j++)
		{
			if(i>=a[j]&&i<b[j])
				c[i]++;
		}
	}
	k=c[0];
	for(i=0;i<1000;i++)
	{
	    if(c[i]>k)
			k=c[i];
	}
	
	printf("%d %d",n,k);
	
	return 0;
}
int main()
{
	char c;
	int i=0,j=0,max=0,min=0,a[2000][2],zuich=0,k,m;
	for(m=0;m<2000;m++)
	{
		a[m][0]=0;
a[m][1]=0;
}
    while(c!='\n')
	{scanf("%d",&a[j][0]);
		c=getchar();
	j++;
	}
    for(k=0;k<=j-1;k++)
	{scanf("%d",&a[k][1]);
		if(k!=j)c=getchar();
	}

i=j-1;
	for(j=0;j<1000;j++)
	{int x=0;
		for(k=0;k<i+1;k++)
			if((a[k][0]<=j)&&(a[k][1]>j))
                 x++;
			if(x>=zuich)
				zuich=x;
	}

	printf("%d %d",i+1,zuich);
	return 0;
}
int ppow(char p,int q){
    int x,y;
    y=(int)(p-48);
   for(x=1;x<=q;x++)
     y=y*10;
     return y;
     }
      
int main(){
    char aa[5000],bb[5000],s;
    gets(aa);
    gets(bb);
    int i=0,j=0,l,a,m,n;
    while(aa[i]!='\0'){
      if(aa[i]==',')
      j++;
      i++; 
      }
      j++;
      int cc[j+1][2],dd[1000],i1,k1,i2,k2;
         for(i=1;i<=j;i++){
                     cc[i][0]=0;
                     cc[i][1]=0;
                     }  
      i1=0;
      i2=0;
      m=1; 
        do{
         k1=1;
         k2=1;
         while(aa[i1+k1]!=','&&aa[i1+k1]!='\0')
              k1++;
          while(bb[i2+k2]!=','&&bb[i2+k2]!='\0')
              k2++;
           for(l=i1;l<i1+k1;l++)
           cc[m][0]=cc[m][0]+ppow(aa[l],k1-l+i1-1);
           for(l=i2;l<i2+k2;l++)
           cc[m][1]=cc[m][1]+ppow(bb[l],k2-l+i2-1);
           m++;
           i1=i1+k1+1;
           i2=i2+k2+1;
           }while(m!=j+1);
    for(i=1;i<=999;i++)
         dd[i]=0;
    for(i1=1;i1<=999;i1++){
         for(i2=1;i2<=j;i2++){
               if(i1>=cc[i2][0]&&i1<cc[i2][1])
                    dd[i1]++;
                    }
                    }
          a=dd[1];                                
    for(i=2;i<=999;i++){
      if(a<dd[i])
        a=dd[i];
        }
      cout<<j<<" "<<a;
         return 0;
      }
int main()
{
	int x[1001],y[1001],peak[1001],peak2[1001],sum,tmp,min=0,max=0;
	char coma[1001];
	int i,j,k,time;
	for(i=0;i<1001;i++)
	{
		peak[i]=0;
		x[i]=0;
		y[i]=0;
	}
	for(i=0;;i++)
	{
		cin>>x[i];		
		if(cin.get()!=',')
		{
			sum=i+1;
			break;
		}

	}
	for(j=0;j<sum;j++)
	{
		cin>>y[j];
		cin.get(coma[j]);
	}
	
	for(k=0; k<=1001 ;k++)
	{
		for(i=0;i<sum;i++)
		{
			if(x[i]<=k && k<y[i])
			{
				peak[k]++;
			}
		}
		//cout<<peak[k]<<' ';
	}
//	for(k=min; k<=max ;k++)
//	{
//		cout<<peak[k]<<' ';
//	}
	for(i=0;i<1000;i++)
	{
		for(j=0;j<1000-i;j++)
		{
			if(peak[j]<peak[j+1])
			{
				tmp=peak[j];
				peak[j]=peak[j+1];
				peak[j+1]=tmp;
			}
		}
	}
	cout<<sum<<' '<<peak[0]<<endl;
	return 0;
}
//***************************************
//* ????????                    *
//* ????? 1300017657               *
//* ???2013.10.30                    *
//***************************************

int main()
{
	int a[1000];                              // a[]???????????????
	for (int i = 0; i < 1000; i++) a[i] = 0;  // ?????
	int n = 0, x, y;                          /* n??????????
	x??????????y?????????*/
	char ch = ',';

	while (ch == ',')
	{
		cin >> x;
		ch = cin.get();
		for (int j = x; j < 1000; j++) a[j]++;
		n++;
	}                                         // ?????????????????????1

	ch = ',';
	while (ch == ',')
	{
		cin >> y;
		ch = cin.get();
		for (int m = y; m < 1000; m++) a[m]= a[m] - 1;
	}                                         // ?????????????????????1

	int max = 0;
	for (int k = 0; k < 1000; k++)
	{
		if (a[k] > max) max = a[k];
	}                                         // ???????????????max

	cout << n << " " << max;
	return 0;
}
int main()
{
	int arrival[1000],depature[1000],i=0,j,count,max=0;
	while(true)   //????????????????????????????
	{
		cin>>arrival[i];
		i++;
		if(cin.get()!=',')
			break;
	}
	int total=i;  //?????
	i=0;
	while(true)   //????????????????
	{
		cin>>depature[i];
		i++;
		if(cin.get()!=',')
			break;
	}
	for(i=0;i<1000;i++)   //?0?1000???????????????????????
	{
		count=0;
		for(j=0;j<total;j++)
			if(i>=arrival[j]&&i<depature[j]) //?count????????????????
				count++;
		if(count>max)   //????????????
			max=count;
	}
	cout<<total<<' '<<max;
	return 0;
}
int change(char p[],int n)
{
	int i,result=0;
	for(i=0;i<n;i++)
	{
		result=result*10+p[i]-'0';
	}
	return result;
}
int manzu(int p[],int n)
{
	if(n>=p[0]&&n<p[1])
		return 1;
	return 0;
}
void main()
{
	int time[1000][2]={0},i=0,j=0,k,num,(*p)[2],max,count=0;
	char ch,temp[5]={'\0'};
	p=time;
	for(k=0;k<=1;k++)
	{
	while((ch=getchar())!='\n')
	{
		if(ch!=',')
			temp[i++]=ch;
		else {temp[i]='\0';time[j++][k]=change(temp,i);i=0;}///
	}
	temp[i]='\0';time[j++][k]=change(temp,i);i=0;
	num=j;
	j=0;
	}
	max=0;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<num;j++)
			if(manzu(p[j],i))///
				count++;
		if(count>max)
			max=count;
		count=0;
	}
	printf("%d %d",num,max);
}
int main()
{
	int A[2000],B[2000],C[2000],i,j,k,number,max=0;
	char c='e';
	for(i=0;i<2000;i++)
		C[i]=0;
	for(i=0;c!='\n';i++)//??????????????
	{
		cin>>A[i];
		cin.get(c);//????
	}
	c='e';
	for(i=0;c!='\n';i++)
	{
		cin>>B[i];
		cin.get(c);
	}
	for(j=0;j<=i;j++)
       for(k=A[j];k<B[j];k++)
		   C[k]++;
	for(j=0;j<2000;j++)
		if(C[j]>max)
			max=C[j];
	cout<<i<<" "<<max<<endl;
	return 0;
}
int main()
{
	char c;
	int max(int array[]);
	int x[1000]={0},y[1000]={0};
	int a[1000]={0},num,i,j;
	for(i=0;i<1000;i++)
	{
		scanf("%d",&x[i]);
		c=getchar();
        if(c=='\n')break;
	}
	for(i=0;i<1000;i++)
	{
		scanf("%d",&y[i]);
		c=getchar();
        if(c=='\n')break;
	}
	num=i+1;
	for(i=0;i<1000;i++)
	{
		for(j=0;j<num;j++)
		{
			if(x[j]<=i&&y[j]>i)
			{
				a[i]=a[i]+1;
			}
		}
	}
	printf("%d %d\n",num,max(a));
	return 0;
}

int max(int array[])
{
	int x=0,i;
	for(i=0;i<1000;i++)
	{
		if(array[i]>x)
			x=array[i];
	}
	return(x);
}
int main()
{
	int x[2000], y[2000], i = 1, j, sum = 0, pep[2000], k = 0;
	char ch = ',';
	while(ch == ',')
	{
		cin >> x[i];
		sum++;
		i++;
		ch = cin.get();
	}
	for(i = 1; i <= sum - 1; i++)
		cin >> y[i] >> ch;
	cin >> y[sum];
	for(i = 1; i <= 2000; i++)//pep?????
		pep[i] = 0;
	for(i = 1; i <= sum; i++)//?sum??????
		for(j = x[i]; j < y[i]; j++)//?pep??????i?????????1
			pep[j]++;
	for(i = 1; i <= 2000; i++)//?pep?????
	{
		for(j = 1; j <= 2000; j++)
		{
			if(pep[i] < pep[j])
				break;
			k++;
		}
		if(k == 2000)//???????????sum????
			{
				cout << sum << " " << pep[i] << endl;
				return 0;//????
			}
		k = 0;
	}
}
int main()
{
     int i,j,n,m,temp,arrive[1500],leave[1500],times[1001]={0};
     char c;
     c=getchar();
     while(c!=EOF)
     {
       n=0;
       while((c!='\n')&&(c!=EOF)) // ???1?
       {
         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')&&(c!=EOF)) // ???1?
       {
         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 n = 0, i, j, x[1000], y[1000], count[1001] = {0}, max = 0;
	while (1)
	{
		cin >> x[n++];
		if (cin.get() == '\n') break;
	}
	for (i = 0; i < n; i++)
	{
		cin >> y[i];
		for (j = x[i]; j < y[i]; j++)
		{
			count[j] ++;  // ?????????????
		}
		if (cin.get() == '\n') break;
	}
	for (i = 0; i < 1001; i++)
	{
		if(max < count[i]) max = count[i];
	}
	cout << n << " " << max << endl;
	return 0;
}
void main()
{
	char c1[10000],c2[10000];
	int len,i,j,b=0,k=0,a[1200][2],t[1200]={0},max=0;
	gets(c1);
	gets(c2);
	len=strlen(c1);
	for(i=0;i<len;i++)
	{
		if(c1[i]!=','&&b==0)
		{
			a[k][0]=c1[i]-'0';
			b=1;
		}
		else if(c1[i]!=',')
		{
			a[k][0]=a[k][0]*10+c1[i]-'0';
		}
		else if(c1[i]==',')
		{
			b=0;
			k++;
		}
	}
	k=0;
	b=0;
	len=strlen(c2);
	for(i=0;i<len;i++)
	{
		if(c2[i]!=','&&b==0)
		{
			a[k][1]=c2[i]-'0';
			b=1;
		}
		else if(c2[i]!=',')
		{
			a[k][1]=a[k][1]*10+c2[i]-'0';
		}
		else if(c2[i]==',')
		{
			b=0;
			k++;
		}
	}
	for(i=0;i<=k;i++)
	{
		for(j=a[i][0];j<a[i][1];j++) t[j]++;
	}
	for(i=0;i<1000;i++)
	{
		if(t[i]>max) max=t[i];
	}
	printf("%d %d",k+1,max);
}