View Code of Problem 36

#include<stdio.h> 
#include<string.h> 
int main()
{
  int t,i,j;
  scanf("%d",&t);
  getchar();
  int count[t][26];
  for(i=0;i<t;i++)
  {
  	for(j=0;j<26;j++)
  	  count[i][j]=0;
  }
  for(j=0;j<t;j++)
  {
  	 char str[1000];
  	 gets(str);	
  	 for(i=0;str[i]!='\0';i++)
  	 {
  	 	if(str[i]>='A'&&str[i]<='Z')
  	 	  count[i][str[i]-'A']++;
	 }
  }
  for(i=0;i<t;i++)
  {
  	for(j=0;j<26;j++)
  	{
  		if(count[i][j]!=0)
  		  printf("%d%c",count[i][j],j+'A');
	}
	printf("\n");
  }
}

Double click to view unformatted code.


Back to problem 36