我的程序输入是有很多行 以最后一行0结束输入 每行有两个string 和一个int
while(true){
String s = scanner.next();
if(s.equals("0")){
break;
}
String e = scanner.next();
int len = scanner.nextInt();
scanner.nextLine();
if(!map.containsKey(e)){
map.put(e, new Node(e));
}
Node st = map.get(s);
if(st.left == null){
st.left = map.get(e);
}else{
st.right = map.get(e);
}
String newString = s + e;
length.put(newString, len);
}
sample input
Mines Brahmsburg 394
Mines Ninel 4
Brahmsburg Thotel 50
Brahmsburg Ninel 5
Ninel Thotel 600
0
当读完倒数第二行 scanner.nextLine()后没法读scanner.next()
应该怎么写?