View Code of Problem 36

#include "stdlib.h"
#include "algorithm"
#include "iostream"
#include <cstdio>
#include "string"
#include <iomanip>
#include <map>
#include <set>
#include "math.h"
using namespace std;
map<char, int> mp;
set<string> st;

int main() 
{
	int t; cin >> t; 
	getchar();
	string str;
	while (t--)
	{
		int x[26] = { 0 };
		getline(cin,str);
		int len = str.length();
		for(int i=0;i<len;i++)
		{
			int j = str[i] - 'A';
			x[j]++;
		}
		for (int i = 0; i < 26; i++)
		{
			char a = i + 'A';
			if (x[i] !=0)cout << x[i] << a;
		}
		cout << endl;
	}
	
	return 0;
}

Double click to view unformatted code.


Back to problem 36