//贴个自己写的,应该算是比较好理解的了 import java.util.*; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] cmds1 = new String[] {"reset", "reset", "board", "board", "reboot", "backplane"}; String[] cmds2 = new String[] {" ", "board", "add", "delete", "backplane", "abort"}; String[] operations = new String[] {"reset what", "board fault", "where to add", "no board at all", "impossible", "install first" }; while (in.hasNextLine()) { // 注意 while 处理多个 case String[] str = in.nextLine().split(" "); String cmd1 = str[0], cmd2 = str.length == 1 ? " " : str[1]; int count = 0, res_idx = -1; for (int idx = 0; idx < 6; idx++) { if (cmds1[idx].startsWith(cmd1) && cmds2[idx].startsWith(cmd2)) { count++; if (count > 1) { System.out.println("unknown command"); break; } res_idx = idx; } } if (count == 0) System.out.println("unknown command"); if (count == 1) System.out.println(operations[res_idx]); } } }