#include <algorithm>
#include <cctype>
#include <cstddef>
#include <iostream>
#include <map>
#include <string>
#include <utility>
#include <vector>
using namespace std;
string lower(string s) {
    for (size_t i = 0; i < s.size(); i++) {
        s[i] = tolower(s[i]);
    }
    return s;
}
//使用静态函数的方法比较pair大小
   static bool cmp(pair<string, int> p1, pair<string, int> p2) {
        if (p1.second == p2.second) {
            return p1.first < p2.first;
        }
        return p1.second > p2.second;
    }

// bool cmp(pair<string, int> p1, pair<string, int> p2) {
//     if (p1.second == p2.second) {
//         return p1.first < p2.first;
//     }//这种方法会报错
//     return p1.second > p2.second;
// }

void sortmap(map<string, int> m, vector<pair<string, int>>& vec) {
  //map为非线性容器,只能将map中的pair加入到vector中排序,并用vector输出
    map<string, int>::iterator it = m.begin();
    while (it!=m.end()) {
    vec.push_back(pair<string,int>(it->first,it->second));it++;
    }
  
    sort(vec.begin(), vec.end(),cmp);
}
int main() {
    string s;
    map<string, int> m;
    while (cin >> s) {
        s = lower(s);
        if (s.find('.') != string::npos) {
            s.erase(s.find('.'));
            m[s]++;
            break;
        }
        m[s]++;
    }
    vector<pair<string, int>> ves;
    sortmap(m, ves);

vector<pair<string, int>>::iterator it=ves.begin();
    for (; it != ves.end(); it++) {
        cout << it->first << ":" << it->second << endl;
    }

}
// 64 位输出请用 printf("%lld")