View Code of Problem 36

#include <iostream>
using namespace std;
int main(){
	int t;
	cin>>t;
	while(t--){
		int h[128]={0};
		string s;
		cin>>s;
		for(int i=0;i<s.size();i++)
			h[s[i]]++;
		for(int i=0;i<128;i++){
			if(h[i]!=0) cout<<h[i]<<(char)i;
		}
		cout<<endl;
	}
} 

Double click to view unformatted code.


Back to problem 36