View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36