#include <iostream>
#include <sstream>
#include <unordered_map>
#include <vector>

using namespace std;

int main() {
    string str;
    string name, row, key;
    int index = 0;
    vector<string> errV(8, "");
    unordered_map<string, int> errM;
    while (getline(cin, str)) {
        istringstream iss(str.substr(0, str.find(' ')));
        while (getline(iss, name, '\\'));
        int l = name.size();
        if (l > 16) name = name.substr(l - 16);
        row = str.substr(str.find(' ') + 1);
        key = name + " " + row;
        if (errM.find(key) == errM.end()) {
            errM[key] = 1;
            errV[index] = key;
            index = (index + 1) % 8;
        } else {
            errM[key] ++;
        }
    }
    for (int i = 0; i < 8; ++i) {
        if (errV[index] != "") {
            cout << errV[index] << " " << errM[errV[index]] << endl;
        }
        index = (index + 1) % 8;
    }

    return 0;
}