View Code of Problem 36

#include<stdio.h> 
#include<string.h> 
int main()
{
  int t,i,j;
  scanf("%d",&t);
  int count[26];
  while(t--)
  {
  	 char str[1000];
  	 scanf("%s",str);
  	 for(i=0;i<26;i++)
  	  count[i]=0;
  	 for(i=0;i<strlen(str);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