View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36