#include <unordered_map>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>

using namespace std;

int main() {
    stringstream f("Мама мыла мыла раму");
    string word;
    unordered_map<string, size_t> dict;
    while (f >> word) ++dict[word];
    vector<pair<string, int> > res;
    res.reserve(dict.size());
    copy(dict.begin(), dict.end(), back_inserter(res));
    sort(res.begin(), res.end(), [](const auto & a, const auto & b) {return a.second > b.second;});
    for (auto & w_c : res) cout << w_c.first << " : " << w_c.second << endl;
	return 0;
}