#include <bits/stdc++.h> using namespace std; int main() { string str; deque<pair<string, int>> ans; unordered_set<string> pre; while (getline(cin, str)) { int r = str.size() - 1; while (r >= 0 && str[r] != ' ') --r; int l = r - 1; while (l >= 0 && r - l <= 16 && str[l] != '\\') --l; string tmp(str.begin() + l + 1, str.end()); if (pre.find(tmp) != pre.end()) // 检查是否为旧记录 continue; bool flag = false; for (auto it = ans.begin(); it != ans.end(); ++it) if (it->first == tmp) { ++it->second; flag = true; break; } if (!flag) { ans.push_back({tmp, 1}); if (ans.size() > 8) { auto preItem = ans.front(); pre.insert(preItem.first); ans.pop_front(); } } } for (auto it = ans.begin(); it != ans.end(); ++it) cout << it->first << ' ' << it->second << endl; return 0; }