View Code of Problem 36

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
int main() {

	int t;
	scanf("%d",&t);
	getchar();
	while(t--) {
		char s[1000];
		int a[26]= {0};
//		scanf("%s",&s);
		gets(s); 
		int len=strlen(s);
		for(int i=0; i<len; i++) {
			if(s[i]>='A'&&s[i]<='Z') {
				int temp=s[i]-'A';
				a[temp]++;
			}
		}
		for(int i=0; i<26; i++) {
			if(a[i]>0) {

				printf("%d%c",a[i],i + 'A');
			}
		}
		if(t>0) {

			printf("\n");	
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36