View Code of Problem 36

#include<iostream>
#include<string>
using namespace std;
int main(){
	int T;
	cin>>T;
	while(T--){
		string s;
		int a[26];
		for(int i=0;i<26;i++){
			a[i]=0;
		} 
		cin>>s;
		for(int i=0;i<s.length();i++){
			if(s[i]>='A'&&s[i]<='Z'){
				a[s[i]-65]++;
			}
		}
		for(int i=0;i<26;i++){
			if(a[i]>0){
				char f='A'+i;
				cout<<a[i]<<f;
			}
		}
		cout<<endl;
	}
}

Double click to view unformatted code.


Back to problem 36