#include <iostream>
#include <map>
#include <string>
#include <vector>
#include <random>

std::string MakeData(std::size_t N){
	std::random_device RD;
	std::mt19937 MT(RD());
	//std::uniform_int_distribution<int> uid('a', 'z');

	std::string Ch = "abcdefghijklnmopqrstuvwxyz";

	std::string R;

	for (size_t i = 0; i < N; i++)
	{
		R += Ch[MT()% Ch.size()];//あえて質の悪い採取方法をとっている。一様乱数が欲しかったらこういう書き方をしてはいけない。
	}
	return R;
}

std::pair<int,std::vector<char>> MakeHoge(std::string str){
	std::map<char, int> M;
	std::map<int, std::vector<char>> MV;

	for (auto& o : str)M[o]++;
	for (auto&o : M)MV[o.second].push_back(o.first);

	return *(MV.rbegin());
}

bool Show(std::pair<int,std::vector<char>>& P,std::string str){
	std::cout << "RESULT:"<<str<<" -> "<<P.first<<'@';
	for (auto& o : P.second) std::cout << o << ',';
	std::cout << std::endl;

	return 0;
}

int main(){
	std::string str;
	std::pair<int, std::vector<char>> P;

	str = "aabaabbab";
	P = MakeHoge(str);
	Show(P,str);

	str = MakeData(27);
	P = MakeHoge(str);
	Show(P,str);

	return 0;
	
}