View Code of Problem 36

#include<stdio.h>
#include<string.h>
int main()
{
char str[1000];
int i,t,a[28],j;
int s=0;

scanf("%d\n",&t);
while(t--)
{
gets(str);
for(i=0;i<28;i++)
a[i]=0;
for(i=0;i<strlen(str);i++)
{
if(str[i]>='A'&&str[i]<='Z')
a[str[i]-'A'+0]++;

}
for(j=0;j<28;j++)
{
	if(a[j]!=0)
printf("%d%c",a[j],j+'A');
}
printf("\n");
}
return 0;
}

Double click to view unformatted code.


Back to problem 36