semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
int main()
{
    int a[2][1000],b[2][1000],i=0,n,j,m;
    char c='\0';
  for(i=0;c!='\n';i++)
    { 
    scanf("%d%c",&a[0][i],&c);
    }
   
    i=0;c='\0';
  for(i=0;c!='\n';i++)
    {
    scanf("%d%c",&a[1][i],&c);
    }
    n=i;
    //for(i=0;i<n;i++)printf("%d %d\n",a[0][i],a[1][i]);
    int p[1001]={0};
    float t;
    for(t=0.5,i=0;t<=998.5;t++,i++)
    {
    //printf("%f",t);
    for(j=0;j<n;j++)
    {
    if(a[0][j]<t&&a[1][j]>t)
     p[i]=p[i]+1;
    }                       
    //printf("%d ",p[i]);
    }
    m=p[0];
   //for(i=0;i<1000;i++)printf("%d ",p[i]);
    for(i=0;i<1000;i++)
    if(p[i]>m)m=p[i];
   printf("%d %d",n,m);
    getchar();
    getchar();
    getchar();
    getchar();
    getchar();
}
int main()
{
    int i=0,k,j;
	int x[1000]={0},y[1000]={0};
	int t[1000]={0};
	char a;
	scanf("%c",&a);
	while(a!='\n')
	{
		if(a!=',')
		{
		 x[i]=x[i]*10+a-'0';
		}
		else i++;
		scanf("%c",&a);
	}
	scanf("%c",&a);
	i=0;
	while(a!='\n')
	{
		if(a!=',')
		{
		 y[i]=y[i]*10+a-'0';
		}
		else i++;
		scanf("%c",&a);
	}
	printf("%d ",i+1);
	k=i;
	for(j=0;j<=k;j++)
		{
			for(i=x[j];i<=y[j]-1;i++)
			{
				t[i]+=1;
			}
		}
	i=0;
	for(j=1;j<=999;j++)
	{
      if(t[j]>t[i]) i=j;
	}
	printf("%d\n",t[i]);

}
void main()
{
    int i=0,j,k,a[1000][2],b[1002]={0},l,m=0,n=0,max=0;
	char c[2][5000];
	scanf("%s%s",c[0],c[1]);a[0][0]=0;a[0][1]=0;
	for(i=0;i<strlen(c[0]);i++)
	{
		
		if(c[0][i]==',')
		{
			m++;
			a[m][0]=0;
		}
		else{a[m][0]=a[m][0]*10+(c[0][i]-48);}
          }
          for(i=0;i<strlen(c[1]);i++)
        {
                   if(c[1][i]==',')
		{
			n++;
			a[n][1]=0;
		}
		else{a[n][1]=a[n][1]*10+(c[1][i]-48);}
	}
	printf("%d ",m+1);
	for(i=0;i<=m;i++)
	{
		for(j=a[i][0];j<a[i][1];j++)
		{
			b[j]++;
		}
	}
	for(i=0;i<1001;i++)
	{
		if(b[i]>max)max=b[i];
	}
	printf("%d",max);
}
int main(){
	int i,j,number=1,time[1000],high=0;
	//time??????????number????high???????????
	char p[2][4000];
	cin.getline(p[0],4000);
	cin.getline(p[1],4000);
	for(i=0;i<1000;i++)time[i]=0;
	if(p[0][0]==0)number=0;
	for(i=0;p[0][i]!=0;i++)
		if(p[0][i]==',')number++;
	const int n=number;
	int come[n],leave[n];//come????????leave????????
	j=0;
	come[0]=0;
	for(i=0;p[0][i]!=0;i++){
		if(p[0][i]==','){
			j++;
			come[j]=0;
		}
		else come[j]=come[j]*10+p[0][i]-'0';
	}
	j=0;
	leave[0]=0;
	for(i=0;p[1][i]!=0;i++){
		if(p[1][i]==','){
			j++;
			leave[j]=0;
		}
		else leave[j]=leave[j]*10+p[1][i]-'0';
	}
	for(i=0;i<number;i++)
		for(j=come[i];j<leave[i];j++)time[j]++;
	for(i=0;i<1000;i++)
		if(time[i]>high)high=time[i];
	cout<<number<<' '<<high<<endl;
	return 0;
}
/**
 *@ file    1000012834_007homework.cpp
 *@ author  ???
 *@ date    2010-11-26
 *@ description 
 *          ????????????
 */
int g_num, g_minn = 5000, g_maxx = 0;			// ??????num??????minn,maxx????????????????
void trans(int num1[],char str[5000])	// trans???????????????????
{
	int len, i, ii, jj, kk, s;			// ?????????????len,????i,j,ii,jj,kk,????s
	int q[5000];						// ???????????????????????????
	len = strlen(str);					// ???????
	i = 0;								// ???????
	g_num = 0;							// ???????
	while (i < len)						// ??????????????????
	{
		s = 1;							// ???????
		g_num ++;							// ??+1
		ii = i;							// ??
		jj = 1;

		// ????????????????????
		while ((str[ii] != ',') && (ii < len))
		{
			q[jj] = str[ii] - '0';
			jj ++;
			ii ++;	
		}	

		// ????????????????????????????????????????
		for (kk = jj - 1; kk >= 1; kk--)
		{
			num1[g_num] += s * q[kk];			// ??
			s *= 10;						// ??????
		}
		if (num1[g_num] < g_minn)				// ??????????????????????
			g_minn = num1[g_num];				// ???????????????
		if (num1[g_num] > g_maxx)				// ??????????????????????
			g_maxx = num1[g_num];				// ???????????????
		i = ii + 1;							// ????????????????????????
	}
}
int main()
{
	char x[5000], y[5000];					// ???????????????

	// ???????????????????????????????
	int xx[5000] = {0}, yy[5000] = {0}, t[5000] = {0};	
	int j, k, most = 0;						// ???????????????
	cin >> x;								// ????????????
	cin >> y;								// ????????????
	trans(xx,x);							// ????????????????
	trans(yy,y);							// ????????????????
	for (j = 1; j <= g_num; j++)				// ??????????????????
	{
		for (k = xx[j]; k < yy[j]; k++)
			t[k] ++;						// ???????????+1
	}
	for (k = g_minn; k <= g_maxx; k++)			// ??????????????????
	{
		if (t[k] > most)					// ???????????????
			most = t[k];
	}
	cout << g_num  << " " << most << endl;	// ????????????

	return 0;
}
int main()
{
	int x,y,counter=0;
	int num[1000]={0};
	while(cin>>x)
	{
		counter++;
		num[x]++;
		if(cin.get()!=',')
			break;
	}
	while(cin>>y)
	{
		num[y]--;
		if(cin.get()!=',')
			break;
	}
	int max=0,contemperary=0;
	for(int j=0;j<1000;j++)
		{
			contemperary+=num[j];
			if(contemperary>max)
				max=contemperary;
	}
	cout<<counter<<" "<<max;
	return 0;
}
int main()
{
	int num[1000],len1,len2,i,j,k,sp=0,p=0,max=0,max1,a[1000];			//??????????????????????????
	int entry[1000],depart[1000];									//?????????
	char str1[10000],str2[10000],temp[5];							//????????????
	cin>>str1;
	len1=strlen(str1);
	for(i=0;i<=len1;i++)											//?????????
	{
		if(str1[i]==',')
		{
			k=0;
			memset(temp,'\0',sizeof temp);
			for(j=sp;j<i;j++)
				temp[k++]=str1[j];
			entry[p]=atof(temp);
			p+=1;
			sp=i+1;
		}
		else if(str1[i]=='\0')
		{
			k=0;
			memset(temp,'\0',sizeof temp);
			for(j=sp;j<i;j++)
				temp[k++]=str1[j];
			entry[p]=atof(temp);
			sp=0;
			p=0;
		}
		else
			continue;
	}
	cin>>str2;
	len2=strlen(str2);
	for(i=0;i<=len2;i++)											//?????????
	{
		if(str2[i]==',')
		{
			k=0;
			memset(temp,'\0',sizeof temp);
			for(j=sp;j<i;j++)
				temp[k++]=str2[j];
			depart[p]=atof(temp);
			p+=1;
			sp=i+1;
		}
		else if(str2[i]=='\0')
		{
			k=0;
			memset(temp,'\0',sizeof temp);
			for(j=sp;j<i;j++)
				temp[k++]=str2[j];
			depart[p]=atof(temp);
			p+=1;
			cout<<p;
		}
		else
			continue;
	}
	for(i=0;i<p;i++)														//?????????
	{
		if(max<depart[i])
			max=depart[i];
	}
	memset(a,0,sizeof a);
	memset(num,0,sizeof num);
	for(j=0;j<max;j++)
	{
		a[j]=j+1;
		for(i=0;i<p;i++)
		{
			if(a[j]<depart[i]&&a[j]>=entry[i])
				num[j]+=1;													//???????????
		}
	}
	max1=0;
	for(i=0;i<max;i++)
		if(max1<num[i])
			max1=num[i];														//????????????
	cout<<" "<<max1;
	return 0;
}
/*
 * T22.cpp
 *
 *  Created on: 2012-11-10
 *      Author: weiwan
 */

int main()
{
	int x[1010],y[1010],count[1010],xmin,ymax,countmax;
	int i,j;
	int n = 0;
	char c;
	memset(count,0,sizeof(count));
	do
	{
		cin >>x[n];n++;
		c = getchar();
	}while(c != '\n');
	n = 0;
	do{
		cin >>y[n];n++;
		c = getchar();
	}while(c != '\n');

	xmin = x[0];
	for (i = 1;i < n;i ++)
		if(x[i] < xmin)xmin = x[i];

	ymax = y[0];
	for (i = 1;i < n;i ++)
		if (y[i] > ymax)ymax = y[i];

	for (i = xmin;i <= ymax;i ++)
		for (j = 0;j < n;j ++)
		{
			if (x[j] <= i && y[j] > i)count[i] ++;
		}

	countmax = count[0];
	for (i = xmin;i <= ymax;i ++)
		if (count[i] > countmax)countmax = count[i];

	cout <<n <<' ' <<countmax <<endl;

	return 0;
}
// ?????? ???1000010500
// ?????
// 2010-11-24
 

int total(char[]);                       //?????
int hign(int[],int[],int);           // ???? 
char t[2][100000];                 
int main()
{
    int i,j,n,num[2][100000];
    
    cin.getline(t[0],100000);
    cin.getline(t[1],100000);
    memset(num,0,sizeof(num));
    
    i = 0;
    for (j = 0;t[0][j] != '\0';j ++)     // ??????? 
    {
        if (t[0][j] == ',')
        {
                 i += 1;                 
                 continue;
        }  
        num[0][i] = num[0][i] * 10 + t[0][j] - '0';
    }
    n = i;
    i = 0;
    for (j = 0;t[1][j] != '\0';j ++)       // ???????
    {
        if (t[1][j] == ',')                
        {
                 i += 1;
                 continue;
        }
            
        num[1][i] = num[1][i] * 10 + t[1][j] - '0';
    }

    cout << total(t[0]) << ' ' << hign(num[0],num[1],n);
    return 0;
}

int total(char t[])
{
    int count = 1,i;                         // ??????1 
    for (i = 0;t[i] != '\0';i ++)
        if (t[i] == ',')
            count ++;
    return count;
}

int hign(int a[],int b[],int n)     // ??????? ??? 
{
    int i,j,count,max = 0;
    for (i = 0;i < 1000;i++)
    {
        count = 0;
        for (j = 0;j <= n;j ++)
        {
            if (a[j] <= i && b[j] > i)    // ?i???? 
                count ++;
            if (count > max)
                max = count;
        }
    }
    return max;
}
int main()
{
   int t[1000]={0};
   int x[1000],y[1000];
   int i,n=0;
   while(1)
   {
       cin>>x[n];
       n++;
       if(cin.peek()!='\n')
           cin.get();
       else
           break;
   }
   for(i=0;i<n;i++)
   {
       cin>>y[i];
       cin.get();
   } 
   for(i=0;i<n;i++)
   {
       for(int j=x[i];j<y[i];j++)
           t[j]++;
   }
   int max=0;
   for(i=0;i<1000;i++)
   {    if(t[i]>max)
              max=t[i];}
   cout<<n<<" "<<max;
   return 0;
}
int main()
{
	int a[1001],b[1001];
	int i,j,t,k[1001]={0},flag;
	char c[2002];
	for(i=0,t=0;;i++)
	{
		scanf("%d%c",&a[i],&c[i]);
		t++;
		if(c[i]!=',')
			break;
	}
	scanf("%d",&b[0]);
	for(i=1;i<=t-1;i++)
	{
		scanf(",%d",&b[i]);
	}
	for(i=0;i<=1000;i++)
	{
		for(j=0;j<=t-1;j++)
		{
			if(a[j]<=i&&b[j]>=i+1)
				k[i]++;
		}
	}
	for(i=0;i<=999;i++)
	{
		for(j=0;j<=999-i;j++)
		{
			if(k[j]<k[j+1])
			{
				flag=k[j];
				k[j]=k[j+1];
				k[j+1]=flag;
			}
		}
	}
	printf("%d %d",t,k[0]);
	return 0;
}
int main()
{
	int in[1000];
	int out[1000];
	int i=0,j=0;
	int time[1000]={0};
	char a;
	while(cin>>in[i])
	{
		cin.get(a);
		i++;
		if(a!=',') break;
	}
	while(cin>>out[j])
	{
		cin.get(a);
		j++;
		if(a!=',') break;
	}
	for(int k=0;k<i;k++)
	{
		for(int l=0;l<1000;l++)
		{
			if(l>=in[k]&&l<out[k])
				time[l]++;
		}
	}
	int max=0;
	for(int k=0;k<1000;k++)
	{
		if(time[k]>=max)
			max=time[k];
	}
	cout<<i<<" "<<max<<endl;
	return 0;
}
//******************************//
 //*     ?????				*//
 //*     ???1000012711		*//
 //*     ????????		*//
 //*     ???2010.11.24		*//
 //******************************// 
int main()
{
	int t1[1000], t2[1000];				//?????? ???1000??  t1?t2?????
	char a;
	int i, g = 0, t, num, max = 0;		//g??? t??? num??? max?????????
	for (i = 0;;i ++)
	{
		cin >> t1[i];					//?????
		a = cin.get();					//????????
		if (a == ',')					//???????g+1
			g ++;
		if (a == '\n')					//????break
			break;
	}
	for (i = 0;;i ++)
	{
		cin >> t2[i];					//??????????g? ?????g+1?
		a = cin.get();
		if (a == '\n')
			break;
	}
	for (t = 1; t <= 1000; t ++)		//???1????1000 ,?t??????????
	{
		num = 0;
		for (i = 0; i < g + 1; i ++)	//????
		{
			if (t >= t1[i] && t < t2[i])//????t??????
			{
				num ++;					//??+1
				if (num > max)			//????max ?max = num,??????
					max = num;
			}
		}
	}
	cout << g + 1 << " " << max << endl;//????,max
	return 0;
}
/**
 * ?????????.cpp
 * ????????????
 * ??????
 * ???2010.11.30
 */

int main()
{	
	//arrive?????????leave?????????time???????
	int arrive[1001], leave[1001], time[1000] = {0};  
	int peo, max, j, k;   //peo??????,max???????????
	char c;       

	for (peo = 1;; peo++)   
	{
		cin >> arrive[peo];
		c = cin.get();
		if (c == '\n')    //???????
			break;
	}
	for (peo = 1;; peo++)
	{
		cin >> leave[peo];
		c = cin.get();
		if (c == '\n')     //???????
			break;
	}	
	
	cout << peo << " ";    //??????
	for (k = 1; k <= peo; k++)   //?????????????
		for (j = arrive[k]; j < leave[k]; j++)
			time[j]++;    
	max = time[0];
	for (k = 0; k < 1000; k++)    //???????????
		if (time[k] > max)
			max = time[k];
	cout << max << endl;

	return 0;
}
int main()
{
	int a[1000]={0};
	int b[1000][2]={0};
	char c='\0';
	int i=0;
	int max=0,time=0;
	while(c!='\n')
	{
		cin>>b[i][0];
		c=cin.get();
		i++;
	}
	i=0;
	c='\0';
	while(c!='\n')
	{
		cin>>b[i][1];
		c=cin.get();
		i++;
	}
	for(int j=0;j<i;j++)
	{
		for(int t=b[j][0];t<b[j][1];t++)
			a[t]++;
	}
	for(int j=0;j<1000;j++)
	{
		if(a[j]>max)
			max=a[j];
	}
	printf("%d %d\n",i,max);
	return 0;
}
/*
 * 1.cpp
 *
 *  Created on: 2013-1-13
 *      Author: Administrator
 */
int main()
{
	int x[2200] = {0}, y[1100] = {0}, max = 0, t = 0, cnt = 0;
	int i, j = 0, k = 0, len = 0;
	while(cin >> x[k])
	{
        char c = getchar();
        if (c == '\n') cnt++;
		k++;
		if (cnt ==2) break;
	}
	for(i = k / 2; i < k; i++)
	{
		y[j] = x[i];
		j++;
	}
	len = k / 2;
	cout << len << " ";
	for(i = 0; i < len; i++)
	{
		t = 0;
		for(j = 0; j < len; j++)
		{
			if(x[j] <= x[i] && y[j] > x[i])
			{
				t++;
			}
		}
		if(max < t)
			max = t;
		t = 0;
		for(j = 0; j < len; j++)
		{
			if(x[j] <= y[i] && y[j] > y[i])
		    {
			    t++;
		    }
		}
		if(max < t)
		    max = t;
	}
	cout << max << endl;
}
int count(int x[], int y[], int total)
{
    int k,j,num[1000]={0},temp=0;
  for(j=0; j<total;++j)
   {
   for(k=x[j]; k<y[j]; ++k)
   num[k]++;
   }
for(k=0; k<total;++k)
if(num[x[k]]>temp) temp=num[x[k]];
return temp;
}
void main()
{
    char a[8000],b[8000];
    int x[3000],y[3000],i,j,k,l1,l2,n,max,n1=0,n2=0;
    scanf("%s",a);
    scanf("%s",b);
    l1=strlen(a);
    l2=strlen(b);
    for(i=0;i<l1;i++)
    {
        x[n1]=0;
        for(j=i;j<l1;j++)
        {
            if(a[j]<'0'||a[j]>'9')     break;
            else   x[n1]=x[n1]*10+a[j]-'0';
        }
        n1++;
        i=j;
    }
    for(i=0;i<l2;i++)
    {
        y[n2]=0;
        for(j=i;j<l2;j++)
        {
            if(b[j]<'0'||b[j]>'9')     break;
            else    y[n2]=y[n2]*10+b[j]-'0';
        }
        n2++;
        i=j;
    }
    j=count(x,y,n1);
    printf("%d %d",n1,j);
}
static int TIME_LIMIT = 1000;

int parseInput(char * input, int * record);

int main() {
	char input[100000];
	int enter[TIME_LIMIT];
	int leave[TIME_LIMIT];
	for (int i=0; i<TIME_LIMIT; i++) {
		enter[i]=leave[i]=0;
	}
	cin.getline(input, 100000);
	int all = parseInput(input, enter);
	cin.getline(input, 100000);
	parseInput(input, leave);
	
	int max = 0;
	for (int i=0; i<TIME_LIMIT; i++) {
		if (enter[i]-leave[i] > max) {
			max = enter[i]-leave[i];
		}
	}
	cout << all << ' ' << max << endl;
	return 0;
}

int parseInput(char * input, int * record) {
	int idx = 0;
	char number[5];
	int number_idx = 0;
	int count = 0;
	while (idx < strlen(input)) {
		if (input[idx]!=',') {
			number[number_idx++] = input[idx];
		}
		else {
			number[number_idx] = '\0';
			number_idx = 0;
			int inum = atoi(number);
			for (int i=inum; i<TIME_LIMIT; i++) {
				record[i] ++;
			}
			count++;
		}
		idx++;
	}
	
	//???????
	number[number_idx] = '\0';
	int inum = atoi(number);
	for (int i=inum; i<TIME_LIMIT; i++) {
		record[i] ++;
	}
	count++;
	return count;
}
int main()
{
	int i, j, t, max = 0;
	int in[1000], out[1000], num_t[1000] = {0};
	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;
	}
	
	i++;


	cout << i << " ";
	for (j = 0; j < i; j++)
	{
		for(t = in[j];  t < out[j]; t++)
			num_t[t]++;
	}
	for (t = 0; t < 1000; t++)
		if (num_t[t] > max)
			max = num_t[t];
	cout << max << endl;
	return 0;
}
//********************************
//* ???????? **
//* ????? 1300012990 **
//* ???2013.10.31 **
//********************************
int main()
{
	int i=0,j=0,a[1001],b[1001],m[1001]={0},x,y,num=0;
	char ch;                                       
	do
	{
		cin >> a[i];
		ch = cin.get();
		i++;
	}while (ch != '\n');                          
    do                                             
	{
		cin >> b[j];
		ch = cin.get();
		j++;
	}while (ch != '\n');  
	for(x=0;x<i;x++)
		for(y=a[x];y<b[x];y++)
			m[y]=m[y]+1;
	for(y=0;y<1000;y++)
		if(m[y]>num)
			num = m[y];
	cout << i << " "<< num;
	return 0;
}
int main()
{
	int a[1010]={0};
	int x[1010],y[1010];
	char c=',';
	int n=0;
	int i,j;
	i=1;
	while(c!=10)
	{
		scanf("%d%c",&x[i],&c);
		n++;
		i++;
	}
	for(i=1;i<=n;i++)
	{
		scanf("%d%c",&y[i],&c);
	}
	printf("%d ",n);
	for(i=1;i<=n;i++)
	{
		for(j=x[i];j<y[i];j++)
		{
			a[j]++;
		}
	}
	int max=0;
	for(i=0;i<1010;i++)
	{
		if(a[i]>max)
			max=a[i];
	}
	printf("%d",max);
}
int main()
{
	int a[2][1000],i=0,j,c=1000,b=0,m[1000]={0};
	while(1)
	{
		cin>>a[0][i];
		if (cin.get() =='\n')
			break;
		i++;
	}
	i = 0;
	while(1)
	{
		cin>>a[1][i];
		if (cin.get() =='\n')
			break;
		i++;
	}
	for(j=0;j<=i;j++)
	{
		if(a[0][j]<c)
			c=a[0][j];
		if(a[1][j]>b)
			b=a[1][j];
	}
	for(;c<b;c++)
		for(j=0;j<=i;j++)
		{
		if(a[0][j]<=c&&a[1][j]>c)
			m[c]++;
		}
		for(j=0;j<b;j++)
		{
			if(m[0]< m[j])
				m[0]=m[j];
		}
		cout << i+1 <<' '<<m[0];
		return 0;
}
int main()
{
	int i=0,n=1,j=0,k=0,m=0,sum=0;
	int min=10000,max=0,temp=0;
	int a[2000],b[2000];
	while(cin>>a[i])
	{
		if(cin.get()==',')
		{
			n++;
		}
		else
		{
			break;
		}
		i++;
	}
	i=0;
	while(cin>>b[i])
	{
		if(cin.get()!=',')
		{
			break;
		}
		i++;
	}
	/*for(j=0;j<n;j++)
	{
		if(a[j]<min)
		{
			min=a[j];
		}
		if(b[j]>max)
		{
			max=b[j];
		}
	}*/
	for(k=0;k<1000;k++)
	{
		temp=0;
		for(j=0;j<n;j++)
		{
			if(a[j]<=k&&b[j]>k)
			{
				temp++;
			}
		}
		if(temp>sum)
		{
			sum=temp;
		}
	}
	cout<<n<<" "<<sum<<endl;
	return 0;
}
int main()
{
	char x_in[10000],y_in[10000];
	int i,j=0,n1,n2,n3,x[10000]={0},y[10000]={0},k=0,count[1000]={0},max=0;
	cin.getline(x_in,10000,'\n');
	
	cin.getline(y_in,10000,'\n');
	n1=strlen(x_in);
	n3=strlen(y_in);
	for(i=n1;i>=0;i--){
		if(x_in[i]<='9'&&x_in[i]>='0'){
			x[j]=x[j]+(x_in[i]-'0')*pow(10.0,k);
			k++;
		}
		else if((x_in[i-1]<='9'&&x_in[i-1]>='0')&&(x_in[i]<'0'||x_in[i]>'9')){
			k=0;
			j++;}
	}
	n2=j;
	j=0;
	k=0;
	for(i=n3;i>=0;i--){
		if(y_in[i]<='9'&&y_in[i]>='0'){
			y[j]=y[j]+(y_in[i]-'0')*pow(10.0,k);
			k++;
		}
		else if((y_in[i-1]<='9'&&y_in[i-1]>='0')&&(y_in[i]<'0'||y_in[i]>'9')){
			k=0;
			j++;}
	}
	for(i=1;i<1000;i++){
		for(j=0;j<=n2;j++){
			if(i>=x[j]&&i<y[j])
				count[i]++;}}
	for(i=0;i<1000;i++){
		if(count[i]>max)
			max=count[i];
	}
	cout<<n2<<" "<<max<<endl;
	return 0;
}
/*
 * intergratedexercise1.14.cpp
 *
 *  Created on: 2014-1-4
 *      Author: st
 */
int main()
{
	int in[10000],out[10000];
	cin>>in[0];
	int i,l,j=1,k=1;
	while(scanf(",%d",&in[j++]));
	cin>>out[0];
	while(scanf(",%d",&out[k++]));
	int min=in[0],max=out[0];
	for(i=0;i<j;i++)
		if(in[i]<min)
			min=in[i];
	for(i=0;i<k;i++)
		if(out[i]>max)
			max=out[i];
	//cout<<min<<' '<<max<<endl;
	int count=0,tem=0;
	for(i=min;i<max;i++){
		for(l=0;l<j;l++)
			if(in[l]<=i&&out[l]>i)
				tem++;
		if(tem>count)
			    	count=tem;
			    tem=0;
	}
	cout<<j-1<<' '<<count;

}
// ????? ?? 1000062708
int main()
{
	int i, j, n1, n2, t, m = 1, z, x[1000] = {0}, y[1000] = {0};
	char a[100000], b[100000];
	cin.getline(a,100000);
	cin.getline(b,100000);
	n1 = strlen(a);
	n2 = strlen(b);
	i = 0;
	for(j = 0;j < n1;j++)
	{
		if(a[j] != ',')
			x[i] = x[i] * 10 + (a[j] - '0');
		else
			i++;
	}
	i = 0;
	for(j = 0;j < n2;j++)
	{
		if(b[j] != ',')
			y[i] = y[i] * 10 + (b[j] - '0');
		else
			i++;
	}
	t = i + 1;
	for(i = 0;i <= 1000;i++)
	{ 
		z = 0;
		for(j = 0;j < t;j++)
		{
		
			if(x[j] <= i && y[j] >= i + 1)
				z++;
		}
		if(z > m)
			m = z;

	}
	cout << t << " " << m << endl;
	return 0;
}
int main()
{
	char in[10000],out[10000],*p=in,*q=out;
	int x[1000],y[1000],temp1[5],temp2[5],*r=temp1,*s=temp2,i=0,j,count=0,max=0,period;
	for(i=0;i<1000;i++)
	{
		x[i]=y[i]=0;
	}
	i=0;
	cin>>in>>out;
	while(*p!=0)
	{
		if(*p==',')
		{
			p++;
		}
		else
		{
			while(*p!=','&&*p!=0)
			{
				*r=*p-'0';
				p++;
				r++;
			}
			j=0;
			while(r>temp1)
			{
				r--;
				x[i]=x[i]+(*r)*pow((double)10,j);
				j++;
				*r=0;
			}
			i++;
		}
	}
	i=0;
	while(*q!=0)
	{
		if(*q==',')
		{
			q++;
		}
		else
		{
			while(*q!=','&&*q!=0)
			{
				*s=*q-'0';
				q++;
				s++;
			}
			j=0;
			while(s>temp2)
			{
				s--;
				y[i]=y[i]+(*s)*pow((double)10,j);
				j++;
				*s=0;
			}
			i++;
		}
	}
	cout<<i<<" ";
	for(period=0;period<1000;period++)
	{
		for(i=0;i<1000;i++)
		{
			if(x[i]<=period&&y[i]>period)
			{
				count++;
			}
		}
		if(count>max)
		{
			max=count;
		}
		count=0;
	}
	cout<<max<<endl;
	return 0;
}
int main()
{
	int i,j=0,k=0,l,max=0,maxx,min;
	char a[10000],b[10000];
	char a1[1000][100],b1[1000][100];
	int a2[1000],b2[1000],t[1000]={0};
	cin.get(a,10000);
	cin.get();
	cin.get(b,10000);
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]!=',')
		{
			a1[j][k]=a[i];
			k++;
		}
        if(a[i]==',')
        {   
			j++;
			k=0;
		}
	}
	for(i=0;i<=j;i++)
	{
		a2[i]=atoi(a1[i]);
	}
    j=0;
	k=0;
    for(i=0;i<strlen(b);i++)
	{
		if(b[i]!=',')
		{
			b1[j][k]=b[i];
			k++;
		}
        if(b[i]==',')
        {   
			j++;
			k=0;
		}
	}
	for(i=0;i<=j;i++)
	{
		b2[i]=atoi(b1[i]);
	}
	for(i=0;i<1000;i++)
	{
		for(l=0;l<=j;l++)
		{
		   if(i>=a2[l]&&i<b2[l])
		   {
			   t[i]++;
		   }
		}
	}
    min=a2[0];
	maxx=b2[0];
	for(i=0;i<=j;i++)
	{
		if(min>a2[i])
		{
			min=a2[i];
		}
		if(maxx<b2[i])
		{
			maxx=b2[i];
		}
    }
	max=t[0];
	for(i=min;i<=maxx;i++)
	{
		if(max<t[i])
		{
			max=t[i];
		}
	}
	cout<<j+1<<" "<<max;
	return 0;
}
int main()
{
	char x1[10000],y1[10000];
	for(int s = 0; s < 10000; s ++)
	{
		x1[s] = '\0';
		y1[s]='\0';
	}
	int num = 0, i, j, k = 0, max = 1, flag[1000] = {0};
	int x[1000] = {0}, y[1000] = {0};
	gets(x1);
	gets(y1);
	char *px = x1, *py = y1;
	while(*px != '\0')
	{
		x[num] = atof(px);
		num++;
		px++;
		while(*px != ',' && *px != '\0')
			px++;
		px++;
	}
	while(*py != '\0' )
	{
		y[k] = atof(py);
		k++;
		py++;
		while(*py != ','&& *py != '\0')
			py++;
		py++;
	}

	for(i = 0; i < num; i++)
	{
		for(j = x[i]; j < y[i]; j++)
		{
			flag[j]++;
		}
	}
	for(i = 0; i < 1000; i++)
	{
		if(flag[i] > max) max = flag[i];
	}
	cout << num << " " << max << endl;
	/*if((num == 200) && (max == 103))
	{
		cout<<x1<<endl;
		cout<<y1<<endl;
	}*/
	return 0;
}
int main()
{
	int start[1000], out[1000], time[1001];  // in out?????0-999
	memset(time,0,sizeof(time));
	int i = 0, j = 0, k = 0, max = 0;
	char c;
	while (cin >> start[i])
	{
		c = cin.get();
		if (c != '\n')
		{
			i++;
		}
		else
		{
			break;
		}
	}
	while (cin >> out[j])
	{
		c = cin.get();
		if (c != '\n')
		{
			j++;
		}
		else 
		{
			break;
		}
	}
	for (k = 0; k <= i ; k++)
	{
		for (int s = start[k]; s < out[k]; s++)
		{
			time[s]++;
		}
	}
	for (int r = 0; r < 1001; r++)
	{
		if (max < time[r])
		{
			max = time[r];
		}
	}
	cout << i + 1 << " " << max ;
	return 0;
}
int main()
{
	char a[5000], b[5000];
	int c[1000] = {0}, d[1000] = {0}, i, j, t = 0, count;
	
	cin >> a ;
	cin >> b;
	int l = strlen(a);
	j = 0;
	for (i = 0;i < l;i++)
	{
		if (a[i] != ',')
			c[j] = c[j] * 10 + (a[i] - '0');
		else
			j++;
	}
	int l1 = strlen(b);
	j = 0;
	for (i = 0;i < l1;i++)
	{
		if (b[i] != ',')
			d[j] = d[j] * 10 + (b[i] - '0');
		else
		{
			j++;
			t++;
		}
	}
	int sum = 0;
	for (i = 1;i < 1000;i++)
	{
		count = 0;
		for (j = 0;j < t+1;j++)
		{
			if (i >= c[j] && i < d[j])
				count++;
		}
		sum =( sum > count )? sum : count;
	}
	cout << t + 1 << " " << sum;

	return 0;
}
//* * * * * * * * * * * * * * * * * * * * * * * * 
//*?????????                           *
//*?????????.cpp                       *
//*?????  1000012839                       *
//*???2010.11.27                             *
//* * * * * * * * * * * * * * * * * * * * * * * * 


int main()
{
	char x[5000], y[5000];	//	??????x[5000], y[5000]?
	int X[1000] = {0}, Y[1000] = {0};	//	???????????????
	int t[1000] = {0};	//	????????t[1000]?????????????????????0?
	int i, j, k, p, max, m, n = 0, l1, l2;	//	??????i,j,k,m,?max??t[1000]??????n???????????l1,l2???????

	cin >> x >> y;	//	??????x?y?
	l1 = strlen(x);
	l2 = strlen(y);
	j = 0;
	k = 0;	//	????
	for (i = 0; x[i] != '\0'; i++)
	{
		if (x[i] == ',')
			j++;	//	j???????????????1?
	}
	m = j + 1;
	p = j + 1;
	for (i = l1; i >= 0; i--)	
	{
		if (x[i] >= '0' && x[i] <= '9')
		{
			X[m] += (x[i] - '0') * pow(10, k);	//	?????????????????????????X??
			k++;
		}
		else
		{
			m--;
			k = 0;	//	??????????????
		}
	}
	k = 0;
	for (i = l2; i >= 0; i--)
	{
		if (y[i] >= '0' && y[i] <= '9')
		{
			Y[p] += (y[i] - '0') * pow(10, k);
			k++;
		}
		else
		{
			p--;
			k = 0;
		}
	}	//	????????x???????????????Y??
	max = t[0];	//	????max?t[0]?
	for (i = 0; i < 1000; i++)
	{
		for (k = 0; k <= j; k++)
		{
			if (X[k] <= i && Y[k] >= i + 1)
				t[i]++;	//	?????????????????????t?1?
		}
		if (t[i] > max)
			max = t[i];	//	????t???????????????????
	}
	cout << j + 1 << ' ' << max << endl;	//	??????????????????;
	return 0;
}