import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); String s[] = new String[]{"reset","reset board","board add","board delete", "reboot backplane","backplane abort"}; String S[] = new String[]{"reset what","board fault","where to add","no board at all", "impossible","install first","unknown command"}; while(in.hasNext()){ String str = in.nextLine(); String ss[] = str.split(" "); if(ss.length == 1){ // 输入只有1个单词 boolean b = false; // 标记匹配情况 for(int i=0;i<6;i++){ if(s[i].contains(ss[0])){ b = true; // 成功匹配 System.out.println(S[i]); break; } } if(!b){ // 匹配失败 System.out.println(S[6]); } }else if(ss.length == 2){ // 输入有2个单词 int k = 0; // 标记匹配次数 String t = ""; // 标记匹配命令 for(int i=0;i<6;i++){ if(s[i].contains(ss[0]) && s[i].contains(ss[1])){ k++; // 标记匹配次数 t = S[i]; // 标记匹配命令 } } if(k == 1){ // 只匹配一次,输出对应的命令 System.out.println(t); }else{ // 没有匹配或多次匹配,则匹配失败 System.out.println(S[6]); } } } } }