View Code of Problem 36

#include<stdio.h> 

	//第一行输入一个T(T<=500)表明有T组测试样例, 
    //在每个测试样例中,输入一个字符串,不超过1000个字母,保证都为大写字母 
 
int main(){
	//1
	//ABCABC
	//2A2B2C
	
	int T,i,j,len,count[26];
	char str[1000];
	scanf("%d",&T);
	while(T--){
		for(i=0;i<26;i++)
			count[i] = 0;
		scanf("%s",&str);
		i = 0;
		while(str[i]!='\0'){
			j = str[i];
			count[j-65] ++;
			i++;
		}
		for(i=0;i<26;i++){
			if(count[i]){
				printf("%d%c",count[i],i+65);
			}
		}
		printf("\n");
	}
	return 0 ; 
}

Double click to view unformatted code.


Back to problem 36