View Code of Problem 36

#include<stdio.h>
int main()
{
	char str[1000];
	int t,i,k;
	scanf("%d",&t);
	while (t--)
	{   
	    int a[100]={0};
		//gets(str);错了 
		scanf("%s",str);
		for(i=0;str[i]!='\0';i++)
		{
			a[str[i]-64]++;
		 } 
		for(i=1;i<27;i++)
		{    if(a[i]==0)
		       continue;
		    else
			 printf("%d%c",a[i],i+64);
		 }
		printf("\n");
	
	}
	return 0;
 }

Double click to view unformatted code.


Back to problem 36