View Code of Problem 36

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

}

Double click to view unformatted code.


Back to problem 36