View Code of Problem 36

#include<stdio.h> 
#include<string.h> 
int main()
{
  int t,i,j;
  scanf("%d",&t);
  int count[268;
  while(t--)
  {
  	 char str[1000];
  	 gets(str);	
  	 for(i=0;i<28;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<28;i++)
	 {
	 	if(count[i]!=0)
	 	  printf("%d%c",count[i],i+'A');
	 }
     printf("\n");
  }
}
/*
Main.c: In function 'main':
Main.c:7:16: error: expected ']' before ';' token
   int count[268;
                ^
Main.c:26:1: error: expected declaration or statement at end of input
 }
 ^
Main.c:5:11: warning: unused variable 'j' [-Wunused-variable]
   int t,i,j;
           ^
Main.c:5:9: warning: unused variable 'i' [-Wunused-variable]
   int t,i,j;
         ^
*/

Double click to view unformatted code.


Back to problem 36