View Code of Problem 36

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

Double click to view unformatted code.


Back to problem 36