View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36