#include <iostream>
#include <map>
#include <string>
#include <queue>

using namespace std;

using freqMap = map<char, int>;
using freqMapElement = typename freqMap::value_type;

struct cmpByValue
{
	bool operator()(const freqMapElement* p1, const freqMapElement* p2)
	{
    	return p1->second > p2->second;
	}
};

int main()
{
    string s = "ASDASDASD";

    freqMap freq_map;
    for (auto c : s)
    {
        freq_map[c]++;
    }

	priority_queue<
		freqMapElement*,
		std::vector<freqMapElement*>,
		cmpByValue> pq;

    for (auto &elem : freq_map)
    {
        pq.push(&elem);
    }

    freqMapElement* top = pq.top();
    cout << top->first << ' ' << top->second << endl;

    return 0;
}