View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36