View Code of Problem 36

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main() {
	int t,i;
	scanf("%d",&t);
	char a[1000];
	
	while(t--){
		int b[1000]={0};
		scanf("%s",&a);
		for(i=0;i<strlen(a);i++){
			b[a[i]]++;
		}
		for(i='A';i<='Z';i++){
			if(b[i]!=0){
				printf("%d%c",b[i],i);
			}
		}
		printf("\n");
	}
}

Double click to view unformatted code.


Back to problem 36