#include <iostream>
#include <fstream>
#include <vector>
#include <map>
using namespace std;

struct szo {
    string s;
    int n;
};

int szavakszama_vector(ifstream & f)
{
    vector<szo> v;
    string s;
    f >> s;
    while (f.good()) {
        bool talalt = false;
        for (size_t i=0;i<v.size() && !talalt;i++) {
            if (v[i].s == s) {
                v[i].n++;
                talalt = true;
            }
        }
        if (!talalt) {
            szo sz;
            sz.n = 1;
            sz.s = s;
            v.push_back(sz);
            if (v.size()%10==0) cout << "\r" << v.size();
        }
        f >> s;
    }
    for (size_t i=0;i<v.size();i++) {
        cout << v[i].s << ":" << v[i].n << endl;
    }
    return 0;
}

int szavakszama_map(ifstream & f)
{
    map<string, int> m;

    string s;
    f >> s;
    while (f.good()) {
        map<string, int>::iterator it = m.find(s);
        if (it!=m.end()) {
            it->second++;
        } else {
            m[s] = 1;
            if (m.size()%10==0) cout << "\r" << m.size();
        }
        f >> s;
    }
    for (map<string, int>::iterator it = m.begin(); it!=m.end();++it) {
        cout << it->first << ":" << it->second << endl;
    }
    return 0;
}

int main()
{
    ifstream f("b.txt");
//    szavakszama_vector(f);
    szavakszama_map(f);
    return 0;
}