View Code of Problem 36

#include "stdio.h"
#include "math.h"
#include "string.h"

void main()
{
	int i,j,k;
	int t;
	char s[1001];
	scanf("%d",&t);
	for(i=0;i<t;i++)
	{
		int a[1000]={0};
		scanf("%s",s);
		for(j=0;s[j]!='\0';j++)
		{
			a[s[j]-'0']++;
		}
		for(j='A'-'0';j<='Z'-'0';j++)
		{
			if(a[j]!=0)
			printf("%d%c",a[j],j+'0');
		}
		printf("\n");
	}
} 

Double click to view unformatted code.


Back to problem 36