View Code of Problem 36

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main()
{
	int t;
	int k=1;
	string a;
	cin >> t;
	while (t--)
	{
		cin >> a;
		sort(a.begin(), a.end());
		for (int i = 0; i < a.size(); i++)
		{
			
			if (a[i + 1] == a[i])
			{
				k++;
				continue;
			}
			else
				cout << k << a[i] ;
			k = 1;
 
		}cout << endl;
		
	}return 0;
}

Double click to view unformatted code.


Back to problem 36