View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36