import java.util.*;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
Map<String, String> map = new HashMap<>();
map.put("reset", "reset what");
map.put("reset board", "board fault");
map.put("board add", "where to add");
map.put("board delete", "no board at all");
map.put("reboot backplane", "impossible");
map.put("backplane abort", "install first");
Map<Key, String> keys = new HashMap<>();
keys.put(new Key("reset", "board"), "");
keys.put(new Key("board", "add"), "");
keys.put(new Key("board", "delete"), "");
keys.put(new Key("reboot", "backplane"), "");
keys.put(new Key("backplane", "abort"), "");
while (in.hasNextLine()) { // 注意 while 处理多个 case
String str = in.nextLine();
match(str, keys, map);
}
}
private static void match(String str, Map<Key, String> keys, Map<String,String> map) {
String[] arr = str.split(" ");
if(arr.length>2) {
System.out.println("unknown command");
}
if(arr.length==1) {
if("reset".startsWith(arr[0])) {
System.out.println("reset what");
} else {
System.out.println("unknown command");
}
return;
}
int count = 0;
String s = "";
for(Key key : keys.keySet()) {
//依次比较,成功后count++
if(key.a.startsWith(arr[0])) {
if(key.b.startsWith(arr[1])) {
count++;
s = key.a + " " + key.b;
}
}
}
if(count==1) {
System.out.println(map.get(s));
} else {
System.out.println("unknown command");
}
}
static class Key {
String a;
String b;
public Key(String a, String b) {
this.a = a;
this.b = b;
}
}
}