semeru/Code-Code-CloneDetection-POJ104 huggingface dataset:
double ma[100] = {0.00}, fe[100] = {0.00};

void quick_sort1(double a[], int l, int r)
{
	if (l >= r)
		return;
	int lo = l, hi = r;
	double k = a[l];
	while (lo != hi)
	{
		while ((lo < hi) && (a[hi] >= k))
			hi--;
		a[lo] = a[hi];
		while ((lo < hi) && (a[lo] <= k))
			lo++;
		a[hi] = a[lo];
	}
	a[lo] = k;
	quick_sort1(a, l, lo - 1);
	quick_sort1(a, lo + 1, r);
}

void quick_sort2(double a[], int l, int r)
{
	if (l >= r)
		return;
	int lo = l, hi = r;
	double k = a[l];
	while (lo != hi)
	{
		while ((lo < hi) && (a[hi] <= k))
			hi--;
		a[lo] = a[hi];
		while ((lo < hi) && (a[lo] >= k))
			lo++;
		a[hi] = a[lo];
	}
	a[lo] = k;
	quick_sort2(a, l, lo - 1);
	quick_sort2(a, lo + 1, r);
}


int main()
{
	int n, i, man = 0, feman = 0;
	char a[10];
	cin >> n;
	cin.get();
	for (i = 1; i <= n; i++)
	{
		cin >> a; 
		if (a[0] == 'm')
		{
			cin >> ma[man];
			man++;
		}
		if (a[0] == 'f')
		{
			cin >> fe[feman];
			feman++;
		}
		cin.get();
	}
	man--;
	feman--;
	quick_sort1(ma, 0, man);
	quick_sort2(fe, 0, feman);
	cout << fixed;
	for (i = 0; i <= man; i++)
		cout << setprecision(2) << ma[i] << " ";
	for (i = 0; i<= feman - 1; i++)
		cout << setprecision(2) << fe[i] << " ";
	cout << fe[feman] << endl;
	return 0;
}
int main(){
int n,i,a1,a2,j;
double man[40],woman[40],b1,b2;
char s[7];
a1=0;
a2=0;
scanf("%d",&n);
for(i=0;i<n;i++){
 scanf("%s",&s);
 if(s[0]=='m'){scanf("%lf",&man[a1]);  a1++;}
 if(s[0]=='f'){scanf("%lf",&woman[a2]);  a2++;}
}
for(i=0;i<a1-1;i++){
 for(j=0;j<a1-1-i;j++){
  if(man[j]>man[j+1]){
   b1=man[j+1];
   man[j+1]=man[j];
   man[j]=b1;
}
}
}
for(i=0;i<a2-1;i++){
 for(j=0;j<a2-1-i;j++){
  if(woman[j]<woman[j+1]){
   b2=woman[j+1];
   woman[j+1]=woman[j];
   woman[j]=b2;
}
}
}
for(i=0;i<a1;i++){printf("%.2lf ",man[i]);}
for(i=0;i<a2-1;i++){printf("%.2lf ",woman[i]);}
printf("%.2lf",woman[a2-1]);
return 0;
}
int main()
{int m,i,j=0,l=0,n;
	double k,b[100],c[100],t;
	char a[7];
	scanf("%d",&n);
	for(i=0;i<n;i++){
		scanf("%s %lf",a,&k);if(a[0]=='m'){b[j]=k;j++;}
		if(a[0]=='f'){c[l]=k;l++;}}
	for(i=0;i<j;i++){
		for(m=0;m<j-1;m++){
			if(b[m]>b[m+1]){t=b[m];b[m]=b[m+1];b[m+1]=t;}}}
for(i=0;i<l;i++){
		for(m=0;m<l-1;m++){
			if(c[m]<c[m+1]){t=c[m];c[m]=c[m+1];c[m+1]=t;}}}
printf("%.2lf",b[0]);
for(i=1;i<j;i++){
		printf(" %.2lf",b[i]);}
for(i=0;i<l;i++){
		printf(" %.2lf",c[i]);}
}
char a[1001]={0};
void f()
{
int l,i;
l=strlen(a);
for(i=0;i<l;i++)
if(a[i]>='a'&&a[i]<='z')
a[i]=a[i]-'a'+'A';}

int main()
{int b[1000]={0},l,i,j;
cin>>a;
f();
l=strlen(a);
i=0;
while(i<l)
{for(j=0;j<l-i;j++)
{if(a[i+j]==a[i])
b[i]++;
else break;}
i=i+j;}
for(i=0;i<l;i++)
{if(b[i]!=0)
cout<<"("<<a[i]<<","<<b[i]<<")";}
return 0;
}
int main()
{
	char a[1000] = {0};
 	char b[1000] = {0} ;
	cin >> a;
	

	int len = strlen (a);
	int i=0, j = 0, k = 0;
	for(i=0; i<len ; i++)
		if(a[i]>='a' && a[i] <= 'z')
			a[i] -= ('a' - 'A');

    memset(b, 0, sizeof(b));
	b[0] = a[0];


	i = 0;
 	while(i < len)
 	{
		for(j=i+1; j <len ; j++ )
		{
		 	if(a[j] != a[i])
			{
				k++;
				b[k] = a[j];
				break;
			}
		}
		i = j;
	}
		
	
		
	int c[1000];
	memset(c,0,sizeof(c));
	for(i=0,k=0 ; i< len && k < len ;i++ , k++)
	{		
			j=i;
			for(; j<len ;j++)
			{	
				if(b[k] != a[j])
					k++;
				if( b[k] == a[j])
					c[k]++;
			}	
	}
	
	for(i=0 ; i <len ; i++)
	{
		if(b[i] == 0)
			break;
		cout<< "(" << b[i]<< ',' << c[i] <<")" ;
	}
	cout<<endl;
	return 0;
}
main()
{
    char s[1020];
    int len,i,j=0;
    scanf("%s",s);
    len=strlen(s);
    for (i = 0;i < len;i ++)
        if (s[i]<='z'&&s[i]>='a')
            s[i]=s[i]-'a'+'A';
    while(j!=len)
    {
        int le=1;
        for (i = j + 1;s[i]==s[j];i ++)
            le ++,j ++;
        printf("(%c,%d)",s[j],le);
        j ++;
    }
}
int main()
{
	char currChar, lastChar;
	int lastCount = 1;
	cin >> lastChar;
	if (lastChar <= 'z' && lastChar >= 'a')
		lastChar += 'A' - 'a';
	while (cin >> currChar)
	{
		if (currChar <= 'z' && currChar >= 'a')
			currChar += 'A' - 'a';
		if (currChar != lastChar)
		{
			cout << '(' << lastChar << ',' << lastCount << ')';
			lastCount = 1;
			lastChar = currChar;
		}
		else
			lastCount++;
	}
	cout << '(' << lastChar << ',' << lastCount << ')';
	return 0;
}
int main ()
{
    char a[1002]={0};
    cin>>a;
    int count=1;
    for (int i=1;i<=strlen(a);i++)
    {
        if ((a[i]==a[i-1])||(a[i]==a[i-1]+32)||(a[i]==a[i-1]-32))
        {
             count++; 
        }
        else 
        {
             if (a[i-1]>='a'&&a[i-1]<='z')
             {
                  char big=a[i-1]-32;
                  cout<<"("<<big<<","<<count<<")";
                  count=1; 
             }
             else 
             {
                  char big=a[i-1];
                  cout<<"("<<big<<","<<count<<")";
                  count=1;
             }
        }
    }
    

        return 0;
    
}
int main()
{
	int i, l, num=0;
	char a[1000], temp;
	cin.getline(a, 1000, '\n');
	l=strlen(a);
	a[l]='\t';
	a[l+1]='\0';
	temp=a[0];
	for(i=0; a[i] != '\0';)
	{
		if(a[i] == temp || a[i]+32 == temp || a[i]-32 == temp)
		{
			i++;
			num++;
		}
		else
		{
			if(temp<97)
				cout << "(" << temp << "," << num << ")";
			else
				cout << "(" << (char)(temp-32) << "," << num << ")";
			temp=a[i];
			num=0;
		}
	}
	return 0;
}
main ()
{
    char a[1000];
scanf("%s",a);
  int i,j;
   for(i=0;a[i]!='\0';)
              {    int kk=i;
                    int ws;
                     for(ws=i;a[ws]!='\0';ws++)
                           if(a[ws]!=a[ws+1]&&a[ws]!=a[ws+1]+32&&a[ws]!=a[ws+1]-32)
                           break;
                           
                           
                           
                           
                           
                           
                       
                    
                       if(kk<ws)
                       {
                              if(a[ws]>=97)
                          a[ws]=a[ws]-32; 
                          
                          printf("(%c,%d)",a[ws],ws-kk+1);
                          i=ws+1;     
                                }
                       else{
                            
                            
                              if(a[ws]>=97)
                          a[ws]=a[ws]-32; 
                        printf("(%c,1)",a[ws]);
                           i++;}

}

getchar ();
getchar ();
}
main()
{
      char a[1002];
      gets(a);
      int b=1;
      int i;
      for( i=0; a[i]!='\0';i++)
      {
           if('a'<=a[i]&&a[i]<='z')
           a[i]=a[i]-'a'+'A';
      }
      for( i=1; a[i]!='\0';i++)
      {
              if((a[i]==a[i-1]))
              b=b+1;
              else 
              {
                   printf("(%c,%d)",a[i-1],b);
                   b=1;
              }
      }
      printf("(%c,%d)",a[i-1],b);
      getchar();
      getchar();
}
int main()
{
	int i,m,j;
	int b[2000]={0};
	int c[2000]={0};
	char a[2000];
	char s[2000];
	gets(s);
	m=strlen(s);
	for(i=0;i<m;i++)
	{
		if((s[i]>='a')&&(s[i]<='z'))
		s[i]=s[i]-('a'-'A');
	}
	for(i=0;i<m;i++)
	{
		if(s[i]==s[i+1])
		c[i]=1;	
	}
	for(i=0,j=0;i<m;i++)
	{
		if(c[i]==0)
		{
			j++;
			b[j]=i+1;
			a[j]=s[i];
		}
	}
	for(j=0;j<2000;j++)
	{
		if(b[j]!=0)
		printf("(%c,%d)",a[j],b[j]-b[j-1]);
	}
}
main()
{
	int len,j,a=1;        //l&Icirc;&ordf;&Ecirc;&auml;&Egrave;&euml;&micro;&Auml;×&Ouml;·&ucirc;&acute;&reg;&sup3;¤&para;&Egrave; 
	char s[1000];
	scanf("%s",s);
	len=strlen(s);
	//scanf("%d",&l);
	for(int i=0;i<len;i=i+a)
	{
		a=1;
		for(j=i;j<len;j++)
		{
			if(s[j]==s[j+1]||s[j]==s[j+1]-'a'+'A'||s[j+1]==s[j]-'a'+'A')
				a++;
			else
				break;
		}
		if(s[i]>='a'&&s[i]<='z')
			s[i]=s[i]-'a'+'A';
		printf("(%c,%d)",s[i],a);

	}
	
}
int main() {
	char a[1000] = { 0 }, b;
	int t = 1;
	cin >> a;
	for (int i = 0; i < strlen(a); i++) {
		if (i == 0)
			b = a[i];
		else {
			if ((a[i] == b - 'A' + 'a') || (a[i] == b + 'A' - 'a') || a[i] == b)
				t++;
			else {//????????????
				if (b <= 'z' && b >= 'a')
					b = b + 'A' - 'a';
				cout << '(' << b << ',' << t << ')';
				b = a[i];
				t = 1;
			}
		}
		if (i == strlen(a) - 1) {//?????????
			if (b <= 'z' && b >= 'a')
				b = b + 'A' - 'a';
			cout << '(' << b << ',' << t << ')';
		}

	}
	return 0;
}
int main()
{
	int i,k,len;
	char s[1001],c;

	gets(s);

	len=strlen(s);

	

	for(i=0;i<len;i++)
	{ 
		k=1;
		c=s[i];
		if((c>=97)&&(c<=122))
			c=c-32;
        
		while((s[i+1]==c)||(s[i+1]==c+32))
		{i++;
		k++;}
        
		printf("(%c,%d)",c,k);

	}
	return 0;
}
main ()
{
     int n,i,j,k,sum=0;
     char s[1001],c;
     for(i=0;i<1001;i++) s[i]='\0';
     scanf("%s",s);
     for(i=0;s[i]!='\0';)
     {
          k=0;
          for(j=i;j<1001;j++)
          {
               if(s[i]==s[j] || s[i]==s[j]+32 || s[i]==s[j]-32) k++;
               else if(s[i]!=s[j] && s[i]!=s[j]+32 && s[i]!=s[j]-32) 
               {
                    printf("(%c,%d)",(s[i]>='a' && s[i]<='z')?(s[i]-32):s[i],k);
                    sum=sum+k;i=sum;break;
               }
          }
     }
     
}
int main()
{
	int i=0;
	char a[1000];
	gets(a);
	while(a[i]!='\0')
	{
		if(a[i]>='a'&&a[i]<='z')
			a[i]+='A'-'a';
		i++;
	}
	i=0;
	char letter=a[0];
	int again=0;
	while(1)
	{
		if(a[i]==letter)
			again++;
		if(a[i]!=letter)
			{
				printf("(%c,%d)",letter,again);
				again=1;
				letter=a[i];
			}
		if(a[i]=='\0')
			break;
		i++;
	}
	return 0;
}
int main()
{
	char m[1010], t;
	int c = 1;
	cin >> m;
	t = m[0];
	for(int i = 1; i < strlen(m); i++)
	{
		if(m[i] == t || m[i] - 32 == t || m[i]+32 == t)
		{
			c++;
		}
		else
		{
			if(t >= 'A' && t <= 'Z')
				cout << "(" << (char)t <<","<<c<<")";
			else
				cout << "(" << (char)(t-32) <<","<<c<<")";
			c = 1;
			t = m[i];
		}
	}
	if(t >= 'A' && t <= 'Z')
		cout << "(" << (char)t <<","<<c<<")"<<endl;
	else
		cout << "(" << (char)(t-32) <<","<<c<<")"<<endl;
	return 0;
}
int main()
{
	char a[1001]; cin>>a;
	int i,j; int l=strlen(a); int t;char temp;
	for (i=0;i<l;i++) if (a[i]>='a'&&a[i]<='z') a[i]=a[i]+'A'-'a';
	for (i=0;i<l;i++)
	{
		t=0;
		for (j=i;;j++)
			if (a[j]==a[i]) t=t+1;
			else break;
		 temp=a[i];
		cout<<'('<<temp<<','<<t<<')';
		i=i+t-1;
	}
	return 0;
}
int main()
{
	char a[1001];
	int i = 1, k = 0;
	cin.getline(a, 1001);
	while(1)
	{
		if (a[i] == a[i - 1] || (a[i] - a[i - 1]) == 32 || (a[i] - a[i - 1]) == -32)
		   k++;
		else
		{
			if ((a[i - 1] - 'a') >= 0)
				a[i - 1] -= 32;
			cout << "(" << a[i - 1] << "," << k + 1 << ")";
			k = 0;
		}
		if (a[i] == '\0')
			break;
		i++;
	}
	return 0;
}
int main()
{
	int i,j,n,k,counter;
	char a[100]={0},x;
	cin>>a;
	for(i=0;a[i]!=0;i++)
	{
		if(a[i]>=97)
			a[i]=a[i]-32;
	}
	for(i=0;a[i]!=0;)
	{
		x=a[i];
		for(j=i,k=0;a[j]==x;j++)
			k++;
		cout<<"("<<x<<","<<k<<")";
		i=j;
	}
	return 0;
}
/*?????????????????????????
 * ??????????????????????????????????????????????????
 * ???????????????????????????
 *????: 2012-12-23
 *??: ??
 */

int main() {
	char str[1001];
	cin >> str;
	int i, num = 1, len = strlen(str);
	if (str[0] > 96) //??????????
		str[0] -= 32;
	for (i = 1; i <= len; i++) {
		if (str[i] > 96) //????
			str[i] -= 32;
		if (str[i] == str[i - 1]) //???????????
			num++;
		else { //???????????
			cout << '(' << str[i - 1] << ',' << num << ')';
			num = 1;
		}
	}
	return 0;
}
main()
{
      char str[1000];
      int i,sum;
      gets(str);
      i=0;
      sum=1;
      while(str[i]!='\0')
      {
          while(str[i]==str[i+1]||str[i]==str[i+1]+32||str[i]==str[i+1]-32)
          {
          sum=sum+1;
          i=i+1;
          }
      if (str[i]>='a'&&str[i]<='z')
      str[i]=str[i]-32;
      printf("(%c,%d)",str[i],sum);
      i=i+1;
      sum=1;
      }
      getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();getchar();
}
main()
{
      char s[100];
      scanf("%s",s);
      int a;
      int b[10000]={0};
      a=strlen(s);
      int i,j,k;
      for(i=0;i<a;i++)
      {               if(s[i]>='a'&&s[i]<='z')
                      s[i]=s[i]-'a'+'A';
                     
                      
      }
      int f=0;
      int t=0;
      for(i=f;i<a;i++)
      {
         f++;
         b[s[i]]++;
         if(s[i]!=s[i+1])
         {
         
         printf("(%c,%d)",s[i],b[s[i]]);
         b[s[i]]=0;
         }
        
         
      }
      
     }
int main()
{
	int i, j, len, count;
	char a[1001]={0};
	cin.getline(a, 1001);
	len=strlen(a);
	for(i=0; i<len; i++)
	{
		if(a[i]-'Z'>=0)
			a[i]=a[i]-32;
	}
	for(i=0; i<len; i++)
	{
		count=0;
		if(i!=0)
		{
			if(a[i]!=a[i-1])
			{
				for(j=i; j<len; j++)
				{
					if(a[i]==a[j])
						count++;
					else
						break;
				}
				cout << "(" << a[i] << "," << count << ")";
			}
		}
		if(i==0)
		{
			for(j=i; j<len; j++)
				{
					if(a[i]==a[j])
						count++;
					else
						break;
				}
				cout << "(" << a[i] << "," << count << ")";
		}
	}
	return 0;
}
int main()
{
	char str[2000];
	int i,j=0,t;
	gets(str);
	t=strlen(str);
	for(i=0;i<t;i++)
	{
		if(str[i]>'Z')
			str[i]-=32;
	}
	for(i=0;i<t;i++)
	{
		if(str[i]!=str[i-1])
		{
			for(j=i;j<t;j++)
			{if(str[j]!=str[i])
			break;
			}
			printf("(%c,%d)",str[i],j-i);
		}
	}
	return 0;
}
int main()
{
	int i,j,len,a[1000]={0};
	char str[1001]={"0"},c[1001]={"0"};
	gets(str);
	len=strlen(str);
	j=0;
	for(i=0;i<len;i++)
		if(str[i]<=122&&str[i]>=97)
			str[i]-=32;
	c[0]=str[0];
	for(i=0;i<len;i++)
		if(c[j]==str[i])
			a[j]++;
		else{
			j++;
			c[j]=str[i];
			a[j]++;
		}
	for(i=0;i<=j;i++)
		printf("(%c,%d)",c[i],a[i]);
	return 0;
}
main()
{
	char a[1002];
	scanf("%s",a);
	int i;
	for ( i=0;a[i]!='\0';i++){
		if(a[i]>'Z')
		a[i]=a[i]-'a'+'A';
	}
	int l=1;
	for (i=1;a[i]!='\0';i++){
		if(a[i]==a[i-1])
		l++;	
	else{
		printf("(%c,%d)",a[i-1],l);
		l=1;
	}}
	printf("(%c,%d)",a[i-1],l);
	
}
int f(char a,char b)
{
    char c,d;
    c=b+'A'-'a';
    d=b-'A'+'a';
    if((a==b)||(a==c)||(a==d))
    return 1;
    else
    return 0;
}
int g(char a)
{
    char b;
    int c,d;
    c=a-'A';
    d='a'-'A';
    if(c<d)
    return a;
    else
    {
        b=a+'A'-'a';
        return b;
    }
}
int h(int a,int b)
{
    int i;
    int c=1;
    for(i=1;i<=b;i++)
    {
        c=c*a;
    }
    return c;
}
int main()
{
    char a[1001];
    char b[5001];
    char c,d;
    scanf("%s",a);
    int i,j,k,l,m,n,p,q,count;
    i=j=n=0;
    count=1;
    while(a[i])
    {
        n=n+1;
        i=i+1;
    }
    i=0;
    for(i=1;i<=n;i++)
    {
        c=g(a[i-1]);
        d=g(a[i]);
        q=c-d;
        if(q==0)
        count=count+1;
        else
        {
            b[j]='(';
            j++;
            b[j]=g(a[i-1]);
            j++;
            b[j]=',';
            j++;
            p=1;
            for(k=1;k<=1000;k++)
            {
                l=h(10,k);
                m=count/l;
                if(m!=0)
                p=p+1;
                else
                k=1001;
            }
            for(k=1;k<=p;k++)
            {
                b[j]=(count/h(10,p-k))%10+'0';
                j++;
            }
            b[j]=')';
            j++;
            count=1;
        }
    }
    b[j]='\0';
    printf("%s",b);
    return 0;
}
int main()
{
	char input[1001] = {0};
	cin >> input;
	int i, count = 0;
	char c = toupper(input[0]);
	for (i = 0; i < strlen(input); i++)
	{
		if (input[i] == c || toupper(input[i]) == c)
			count++;
		else
		{
			cout << '(' << c << ',' << count << ')';
			count = 1;
			c = toupper(input[i]);
		}
	}
	cout << '(' << c << ',' << count << ')' << endl;
	return 0;
}
main()
{
int i,j,l,k=0;
char s[1000];
char a[1000];
int b[1000];
gets(s);
l=strlen(s);
a[0]=s[0];
b[0]=1;
for(i=1;i<l;i++)
{
 if(s[i]==s[i-1]||(s[i]-s[i-1])==32||(s[i-1]-s[i])==32)
 {
  if(s[i]<91) a[k]=s[i];
  else a[k]=s[i]-32;
  b[k]++;
  }
 else
 {
 k++;
 b[k]=0;
 a[k]=s[i];
 b[k]++;
 }
}
for(j=0;j<=k;j++)
{
if(a[j]<91) printf("(%c,%d)",a[j],b[j]);
else printf("(%c,%d)",a[j]-32,b[j]);
}
getchar();
getchar();
}
int main()
{
	int n, i, k = 0;
	char a = '0';
	char s[1000];
	cin >> s;
	n = strlen(s);
	for(i = 0; i < n; i++)
	{
		if(s[i] == a || (s[i] - 32 == a))
			k++;
		else
		{
			if(k != 0)
				cout << "(" << a << "," << k << ")";
			k = 1;
			a = s[i];
			if(a > 'Z')
				a = a - 32;
		}
	}
	cout << "(" << a << "," << k << ")";
	return 0;
}
/*
 * 2.cpp
 *
 *  Created on: 2011-12-31
 *      Author: 2011
 */
int main()
{

	char a[1000]={0};
	cin>>a;
	//char str1[26]="ABCDEFGHIJKLMNOPQRSTUVWXYZ",str2[26]="abcdefghijklmnopqrstuvwxyz";
	int num[27]={0};
	int len=strlen(a);
	int i=0,j=0;
	for(i=0;i<len;i++)if(a[i]>='a')a[i]-=('a'-'A');
	for(i=0;i<len;i++){
		num[a[i]-'A']++;
		for(j=i+1;j<len;j++){
			if(a[j]==a[i])num[a[i]-'A']++;
			else break;
		}
		cout<<'('<<a[i]<<','<<num[a[i]-'A']<<')';
		num[a[i]-'A']=0;
		i=j-1;
	}
	cout<<endl;
	return 0;
}
void main()
{
	int i,j=0,k=0;
	char a[100];
	for(i=0;;i++)
	{
		scanf("%c",&a[i]);
		if(a[i]=='\n')
			break;
	}
	j=i;
	for(i=0;i<j;i++)
	{
		if(a[i]>'Z')
		a[i]=a[i]-32;
    }
	for(i=0;i<j;i++)
	{
		k+=1;
		if(a[i+1]!=a[i])
		{	
			printf("(%c,%d)",a[i],k);
			k=0;
		}
	}
}
main()
{ int i,m,k;
int c[1000]={0};
  char a[1000],b[1000],e[1000];
  gets(a);
 m=strlen(a);
  for(i=0;i<=m;i++)
	{  if(a[i]<'a')
		  b[i]=a[i];
	  else
		  b[i]=a[i]+'A'-'a';}
  c[0]=1;e[0]=b[0];
  k=0;
  for(i=1;i<=m;i++)
	  {
		  if(b[i]==b[i-1])
		  c[k]=c[k]+1;
	  else
		{  k=k+1;
		  e[k]=b[i];
		  c[k]=c[k]+1;}
  }
  for(i=0;i<=k-1;i++)
  printf("(%c,%d)",e[i],c[i]);
}
struct jisuan
{
	char zimu;
	int count;
}ji[1000];
int zhuanhua(char a)
{
	if(a>='a'&&a<='z')
		return a-32;
	else
		return a;
}
int main()
{
	char str[1001];
	cin>>str;
	int i,l,flag;
	l=strlen(str);
	str[0]=zhuanhua(str[0]);
	ji[0].zimu=str[0];
	ji[0].count =1;
	flag=0;
	for(i=1;i<l;i++)
	{
		str[i]=zhuanhua(str[i]);
		if(str[i]==str[i-1])
			ji[flag].count++;
		else
		{
			flag++;
			ji[flag].zimu=str[i];
			ji[flag].count=1;
		}
	}
	for(i=0;i<=flag;i++)
		cout<<"("<<ji[i].zimu<<","<<ji[i].count <<")";
	return 0;
}
int main()
{
	char num[100];
	for(int i=0;i<100;i++)
	{
		num[i]='0';
	}
	scanf("%s",num);
	for(int i=0;i<100;i++)
	{
		if(num[i]=='0')
		{
			num[i-1]='0';
			break;
		}
	}
	char currChar=num[0];
	if(currChar>='a')
	{
		currChar-='a';
	}
	else
	{
		currChar-='A';
	}
	int count=1;
	int step=0;
	char outChar[100];
	int outNum[100];
	int i=1;
	while(num[i]!='0')
	{
		char nowChar=num[i];
		if(nowChar>='a')
		{
			nowChar-='a';
		}
		else
		{
			nowChar-='A';
		}
		if(currChar==nowChar)
		{
			count++;
		}
		else
		{
			outChar[step]=currChar;
			outNum[step]=count;
			count=1;
			step++;
			currChar=nowChar;
		}
		i++;
	}
	outChar[step]=currChar;
	outNum[step]=count;
	count=0;
	step++;

	for(int j=0;j<step;j++)
	{
		printf("(%c,%d)",outChar[j]+'A',outNum[j]);
	}

	return 0;
}
int main()
{
	char a[200];
	int times[100]={0};//?????????????
	int start[100]={0};//?????????????
	int sum=0;
	int i;
	cin>>a;
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]>='a'&&a[i]<='z')
			a[i]=a[i]-32;
	}
	for(i=0;i<strlen(a);i++)
	{
		if(a[i]==a[i+1])
		{
			times[sum]++;
		}
		else
		{
			times[sum]++;
			sum++;
			start[sum]=i+1;
		}
	}
	for(i=0;i<sum;i++)
		cout<<'('<<a[start[i]]<<','<<times[i]<<')';
	return 0;
}
char q[1200];
char lastQ;
int head,length;

char MT(char q)
{
if ((q>='a')&&(q<='z')) return q-'a'+'A';
}

int main()
{
cin>>q;
head=1;length=1;lastQ=q[0];
while (q[head]!='\0')
{
if (MT(q[head])==MT(lastQ)) length++;
else
{
cout<<'('<<MT(lastQ)<<','<<length<<')';
lastQ=q[head];length=1;
}
head++;
}
cout<<'('<<MT(lastQ)<<','<<length<<')'<<endl;
return 0;
}
int main()
{
	char w[1001];
	int a[1001],i,j;
	for(i=0;i<=1000;i++)
	{
		a[i]=1;
	}
	gets(w);
	for(i=0;w[i]!='\0';i++)
	{
		if(w[i]>=96)
		{
			w[i]=w[i]-32;
		}
	}
	for(i=1,j=1;;i++)
	{
		if(w[i-1]=='\0')
			break;
		if(w[i]==w[i-1])
		{
			a[j]=a[j]+1;
		}
		else
		{
			printf("(%c,%d)",w[i-1],a[j]);
			j=j+1;
		}
	}
	printf("\n");
	return 0;
}
struct letter
{
	char k;
	int res;
}number[1000];

int main()
{
	char a[1100]={0};
	cin>>a;
	int p=0;
	for(int i=0;i<1000;i++)
	{
		number[i].res=0;
	}
	for(int i=0;i<strlen(a);i++)
	{
		if(a[i]<='z'&&a[i]>='a')
		{
			a[i]=a[i]+'A'-'a';
		}
	}
	for(int i=0;i<strlen(a)-1;i++)
	{
		    number[p].k=a[i];
			number[p].res++;
		if(a[i]!=a[i+1])  p++;
		
	}
	number[p].k=a[strlen(a)-1];
			number[p].res++;
	for(int i=0;i<p+1;i++)
	{
		cout<<"("<<number[i].k<<","<<number[i].res<<")";
	}
	
	return 0;
}
main()
{
char c[10000],a;
int i,n;
scanf("%s",c);
a=c[0];
n=1;
if(c[1]=='\0')
{
              if(a-'a'>=0)
              printf("(%c,1)",a-'a'+'A');
              else
              printf("(%c,1)",a);
}
else
{
for(i=1;c[i]!='\0';i++)
      {
                       if((c[i]==a)||(c[i]-'a'+'A'==a)||(c[i]+'a'-'A'==a))
                       {
                                                                         n=n+1;
                                                                         if(c[i+1]=='\0')
                                                                         {
                                                                                         if(a-'a'>=0)
                                                                                         printf("(%c,%d)",a-'a'+'A',n);
                                                                                         else
                                                                                         printf("(%c,%d)",a,n);
                                                                                         }
                       }
                       else
                       {
                               if(a-'a'>=0)
                               printf("(%c,%d)",a-'a'+'A',n);
                               else 
                               printf("(%c,%d)",a,n);
                               n=1;
                               a=c[i];  
                       if(c[i+1]=='\0')
                       {
                        if(a-'a'>=0)
                        printf("(%c,1)",c[i]-'a'+'A');
                        else
                        printf("(%c,1)",c[i]);
                       }
                       }
}
}
      getchar();
      getchar();
}
void c(char *p,int l)
{
     int i;
     
    for(i=0;i<l;i++)
    {
    if((*(p+i))>='a'&&(*(p+i))<='z')
    *(p+i)=*(p+i)+('A'-'a');
}
    
}
int f(char x,char y)
{
    
    if(x==y)
    return 1;
    else 
    return 0;
}
main()
{    int l;
int e;
int count=0;
      char a[1000];
      char *p;
      char q;
      int i;
      scanf("%s",a);
      l=strlen(a);
      p=a;
      c(p,l);
      for(i=0;i<l;i++)
      {
if(l==1)
 printf("(%s,1)",a);
      if(i==0)
      {
      q=a[i];
      count++;
      }
      else
      { 
          if(i!=(l-1))
      {
          e=f(q,a[i]);
          if(e==0)
          {
          printf("(%c,%d)",q,count);
          q=a[i];
          count=1;
                  }
          else
          count++;
      }
      else
      {
      if(q==a[l-1])
       printf("(%c,%d)",q,(count+1));
       else
       {
       printf("(%c,%d)",q,count);
        printf("(%c,1)",a[l-1]);
       }
       }
       }
                      }
                      printf("\n");
                      getchar();
                      getchar();
                      getchar();
      }
int main()
{
	char str[1001];
	cin>>str;
	int i,counter;
	for (i=0;str[i]!='\0';i++)
	{
		if (str[i]>='a' && str[i]<='z')
		{
			str[i]=str[i]+'A'-'a';
		}
	}
	char temp;
	counter=1;
	temp=str[0];
	for (i=1;str[i-1]!='\0';i++)
	{
		if (temp==str[i])
			counter++;
		else
		{
			cout<<'('<<temp<<','<<counter<<')';
			counter=1;
			temp=str[i];
		}
	}
	return 0;
}
int main()
{
	char a[1001],b[1001];
	int c[1001]={0},i,t=0;
	cin.getline (a,1001);

	for ( i=0;a[i]!='\0';i++)
	{
		if (a[i]==a[i-1]||a[i]-a[i-1]==32||a[i-1]-a[i]==32)
		{
			c[t]++;
		}
		else
		{
			t++;
			b[t]=a[i];
			c[t]++;
		

		}
	}
	for (i=0;i<=1000;i++)
	{
		if (c[i]!=0)
		{
			if (b[i]-'a'>=0)
			{
				b[i]=b[i]-32;
			}
			cout << "(" << b[i] << "," << c[i] << ")";
		}
	}
	return 0;
}