#include<iostream>
#include<iomanip>
using namespace std;
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<map>
#define MAX 128
int main() {
ios::sync_with_stdio(false);
string s;
getline(cin, s);
map<string, int>m;
while (s.size() != 0) {
int pos = s.find(' ', 0);
if (pos == s.npos) {
string temp = s.substr(0, s.size() - 1);
s.clear();
transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
//cout << "temp=" << temp << endl;
m[temp]++;
}
else {
string temp = s.substr(0, pos);
s.erase(0, pos + 1);
transform(temp.begin(), temp.end(), temp.begin(), ::tolower);
//cout << "temp=" << temp << endl;
m[temp]++;
}
}
int lastmax = 1 << 30;
int max = -1;
while (max != 0) {
auto it = m.begin();
for (it = m.begin(); it != m.end(); it++) {
if (max < it->second&&it->second<lastmax)max = it->second;
}
for (it = m.begin(); it != m.end(); it++) {
if (max == it->second) {
cout << it->first << ":" << it->second << endl;
}
}
max--;
lastmax = max;
}
return 0;
}