View Code of Problem 36

#include<stdio.h>
int main(){
	int i,T;
	char test[1000];
	scanf("%d",&T);
	for(i = 0; i < T; i ++){
		int count[26] = {0};
		int j = 0;
		char c;
		scanf("%s",test);
		while(1){
			c = test[j++];
			if(c != '\0'){
				int s = c - 'A';
				count[s] ++;
			}else{
				break;
			}
		}
		for(j = 0; j < 26; j ++){
			if(count[j] != 0){
				printf("%d%c",count[j],'A' + j);
			}
		}
		printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36