View Code of Problem 36

#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
int main(){
	int n;
	cin >> n;
	while(n--){
		char s[1000];
		int e[26]={0};
		char c[26];
		int d=0;
		for(char i='A';i<='Z';i++){
			c[d]=i;
			d++;
		}
		cin >> s;
		int a;
		a=strlen(s);
		for(int i=0;i<a;i++){
		    int b;
		    b=s[i]-'A';
		    e[b]++;
		}
		for(int i=0;i<26;i++){
			if(e[i]!=0){
				cout << e[i] << c[i] ;
			}
		}
		cout << endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 36