View Code of Problem 36

#include<stdio.h>
#include<string.h>
#include<math.h>
int main()
{
	int t;
//	char a[1000];
	scanf("%d",&t);
	while(t--)
	{
		char a[1000];
		scanf("%s",a);
		int x[26]={0};
		int i;
		for(i=0;i<strlen(a);i++)
		{
			x[a[i]-'A']++;		
		}
		for(i=0;i<26;i++)
		{
			if(x[i]!=0)
				printf("%d%c",x[i],i+'A');
			else if(i==25)
				printf("\n");
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36