View Code of Problem 36

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

		}
		for (i = 0; i < 26; i++) {
			if (b[i] != 0) {
				printf("%d%c", b[i], i +'A');
			}
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36