View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36