View Code of Problem 36

#include <stdio.h>
#include <stdlib.h>
#include<ctype.h>
#include<string.h>
#include<math.h>
int main()
{
	int t,i,j,k;
	scanf("%d", &t);
	char ch[1000];
	
	while (t--)
	{
		int ABC[26] = { 0 };
		scanf("%s", ch);
		for (i = 0; i < strlen(ch); i++)
		{
			k = ch[i] - 'A';
			ABC[k]++;
		}
		for (i = 0; i < 26; i++)
		{
			if (ABC[i] > 0)
			{
				printf("%d%c", ABC[i],'A'+i);
			}
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36