View Code of Problem 36

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main (){
	int t;
	scanf("%d", &t);
	while(t--){
		int num[256] = {0};
		char s[1010];
		scanf("%s", s);
		for(int i = 0;i < strlen(s);i++){
			num[s[i]]++;
		}
		for(int i = 'A';i <= 'Z';i++){
			if(num[i]!=0) printf("%d%c", num[i], i);
		}
		printf("\n");
	}

	return 0;
}

Double click to view unformatted code.


Back to problem 36