View Code of Problem 36

#include<stdio.h>
#include<string.h>
int main()
{
	int t;
	scanf("%d",&t);
//	getchar();
	if(t>0&&t<=500)
	{
		while(t>0)
		{
			char str[1000];
			int a[27];
			int i,temp;
			for(i=1;i<27;i++)
				a[i]=0;
			scanf("%s",str);
			
			for(i=0;i<strlen(str);i++)
			{
				temp=str[i]-64;
				a[temp]++;
			}
			for(i=1;i<27;i++)
			{
				if(a[i]!=0)
					printf("%d%c",a[i],i+64);
			}
				
			printf("\n");
			t--;
		}
	}
	
	
	return 0;
}

Double click to view unformatted code.


Back to problem 36