#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
map<char,int> frequencies;
void counting(char c) {
// add one to the frequency-count for character c.
frequencies[c]++;
}
void printing(pair<char,int> the_pair){
cout << the_pair.first << " " << the_pair.second << endl;
}
string s="classes, containers and maps";
int main ()
{
// give each letter in s to the counting function, then
// print the resulting frequencies
for_each(s.begin(), s.end(), counting);
for_each(frequencies.begin(), frequencies.end(), printing);
}
I2luY2x1ZGUgPGlvc3RyZWFtPiAKI2luY2x1ZGUgPGFsZ29yaXRobT4KI2luY2x1ZGUgPG1hcD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsgCgptYXA8Y2hhcixpbnQ+IGZyZXF1ZW5jaWVzOwoKdm9pZCBjb3VudGluZyhjaGFyIGMpIHsKICAgLy8gYWRkIG9uZSB0byB0aGUgZnJlcXVlbmN5LWNvdW50IGZvciBjaGFyYWN0ZXIgYy4KICAgZnJlcXVlbmNpZXNbY10rKzsKfQoKdm9pZCBwcmludGluZyhwYWlyPGNoYXIsaW50PiB0aGVfcGFpcil7CiAgICBjb3V0IDw8IHRoZV9wYWlyLmZpcnN0IDw8ICIgIiA8PCB0aGVfcGFpci5zZWNvbmQgPDwgZW5kbDsKfQoKc3RyaW5nIHM9ImNsYXNzZXMsIGNvbnRhaW5lcnMgYW5kIG1hcHMiOyAKCmludCBtYWluICgpCnsKICAgLy8gZ2l2ZSBlYWNoIGxldHRlciBpbiBzIHRvIHRoZSBjb3VudGluZyBmdW5jdGlvbiwgdGhlbgogICAvLyBwcmludCB0aGUgcmVzdWx0aW5nIGZyZXF1ZW5jaWVzCiAgIGZvcl9lYWNoKHMuYmVnaW4oKSwgcy5lbmQoKSwgY291bnRpbmcpOwogICBmb3JfZWFjaChmcmVxdWVuY2llcy5iZWdpbigpLCBmcmVxdWVuY2llcy5lbmQoKSwgcHJpbnRpbmcpOwp9