View Code of Problem 36

#include<stdio.h>
#include<string.h>
int main(){
	char str[100];
	int a=-1,i,n,j,str1[26];
	for(i=0;i<26;i++){
		str1[i]=0;
	}
	scanf("%d",&a);
	for(i=0;i<a+1;i++){
	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);
	}
	if(i!=0)
	printf("\n");
	}
}

Double click to view unformatted code.


Back to problem 36