View Code of Problem 36

#include <stdio.h>

int main(){
	int T,i,k;
	scanf("%d",&T);
	while(T--)
	{
		char s[1000];
		scanf("%s",s);
		int num[26] = {'0'};
		i=0;
		while (s[i] != '\0') 
		{
			int j = s[i] - 65;
			num[j]++;
			i++;
		}
		for (k = 0;k < 26;k++) 
		{
			if (num[k] != 0) 
			{
				printf("%d%c", num[k], k + 65);
			}
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36