import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
ArrayList<String> list = new ArrayList<>();
while (sc.hasNextLine()) {
String line = sc.nextLine();
if (line.equals("")) {
break;
}
list.add(line);
}
LinkedHashMap<String, Integer> map = new LinkedHashMap<>();
for (int i = 0; i < list.size(); i++) {
String[] split = list.get(i).split(" ");
String filePath = split[0];
String[] strings = filePath.split("\\\\");
String fileName = strings[strings.length - 1];
if (fileName.length() > 16) {
fileName = fileName.substring(fileName.length() - 16);
}
// 文件名相同,行数不同,不算同一记录
String key = fileName + " " + split[1];
Integer count = map.get(key);
if (count == null) {
map.put(key, 1);
} else {
map.put(key, map.get(key) + 1);
}
}
Set<Map.Entry<String, Integer>> entrySet = map.entrySet();
Set<String> keySet = map.keySet();
int num = 0;
if (keySet.size() > 8) {
for(String string : map.keySet()){
num++;
// *******
if( num > (map.keySet().size()-8)) //输出最后八个记录
System.out.println(string+" "+map.get(string));
}
} else {
for (Map.Entry<String, Integer> entry : entrySet) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
}
}
}