View Code of Problem 36

#include<bits/stdc++.h>
using namespace std; 


int main()
{
	int t, a[26];
	string s;
	cin >> t;
	while(t--)
	{
		memset(a, 0, sizeof(a));
		cin >> s;
		int len = s.size();
		for(int i = 0; i < len; i++)
		{
			a[s[i] - 'A']++;
		}
		for(int i = 0; i < 26; i++)
		{
			if(a[i] != 0)
				cout << a[i] << (char)('A' + i);
		}
		cout << endl;
	}
	


	return 0;
}

Double click to view unformatted code.


Back to problem 36