View Code of Problem 36

#include<stdio.h>
#include<string.h>
int main(){
    int T;
    while(scanf("%d\n",&T)!=EOF){
    	
		char test[1000];
		int a[26];
		gets(test);
		for(int i=0;i<=25;i++){
				a[i]=0;
		} 
		for(int i=0;i<strlen(test);i++){
			int k=test[i]-'A';
			a[k]++;
		}
		for(int i=0;i<=25;i++){
				if(a[i]!=0){
					printf("%d%c",a[i],i+65);
				}
		} 
		printf("\n");
	} 
} 

Double click to view unformatted code.


Back to problem 36