View Code of Problem 36

#include<stdio.h>
#include<string.h>
int main(){
	char str[1000];
	int a,i,n,j,str1[26];

	scanf("%d",&a);
	for(i=0;i<a+1;i++){
	for(j=0;j<26;j++){
		str1[j]=0;
	}
	gets(str);
	n=strlen(str);
	for(j=0;j<n;j++){
		str1[str[j]-65]++;
	}
	for(j=0;j<26;j++){
		if(str1[j]!=0)
		printf("%d%c",str1[j],j+65);
	}
	printf("\n");
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36