View Code of Problem 36

#include <stdio.h>
#include <string.h>
int main()
{
	int a[26] = {0};
	char s[1000];
	int t;
	scanf("%d",&t);
	
	while(t--)
	{
		int i;
		getchar();
		gets(s);
		for(i = 0;i < strlen(s);i++)
		{
			a[s[i]-65]++;
		}
		for(i = 0;i < 26;i++)
		{
			if(a[i])
			{
				printf("%d%c",a[i],i+65);
			}
		}
		putchar(10);
	}
	
	return 0;	
}

Double click to view unformatted code.


Back to problem 36