import java.util.LinkedHashMap;
import java.util.Scanner;
public class 简单错误记录 {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
LinkedHashMap<String,Integer> lhm=new LinkedHashMap<String,Integer>();
while(sc.hasNext()){
String in=sc.nextLine();
String[] arr=in.split(" ");
String path=arr[0];//路径
String[] file=path.split("\\\\");
String filename=file[file.length-1];//净文件名称
String row=arr[arr.length-1];//行号
String key="";
if(filename.length()>16){
key=filename.substring(filename.length()-16)+" "+row;
}else{
key=filename+" "+row;
}
if(!lhm.containsKey(key)){
lhm.put(key, 1);
}else{
int x=lhm.get(key);
lhm.put(key, x+1);
}
}//while
int count=0;
for(String string:lhm.keySet()) {
if(count>=(lhm.size()-8)) {
System.out.println(string+" "+lhm.get(string));
}
count++;
}
}//main
}
简单错误记录(LinkedHashMap:有顺序的存和取)
最新推荐文章于 2025-06-28 05:06:31 发布