#include <iostream> #include <string> #include <map> #include <queue> using namespace std; int main() { string s; map<string, int> ms; queue<string> qs; while(getline(cin, s)) { string s1 = s.substr(s.find_last_of('\\')+1, s.length()); s1 = s1.substr(0, s1.find_last_of(' ')); if (s1.length() > 16) s1 = s1.substr(s1.length()-16, s1.length()); string s2 = s.substr(s.find_last_of(' ')+1, s.length()); s1 = s1 + " " + s2; if (ms.find(s1) == ms.end()) { ms[s1] = 1; if (qs.size() < 8) { qs.push(s1); } else { qs.pop(); qs.push(s1); } } else { ms[s1] += 1; } } int size = qs.size(); for (int i = 0; i < size; i++) { string ts = qs.front(); cout << ts << " " << ms[ts] << endl; qs.pop(); } } // 64 位输出请用 printf("%lld")