#include <iostream> #include <vector> using namespace std; int main() { string str; vector<pair<string, string>> vecin = { { "reset", "" }, { "reset", "board" }, { "board", "add" }, { "board", "delete" }, { "reboot", "backplane" }, { "backplane", "abort" } }; vector<string> vecout = { "reset what", "board fault", "where to add", "no board at all", "impossible", "install first" }; while (getline(cin, str)) { string s1,s2; int pos=0; while(pos<str.size() && str[pos]!=' '){pos++;} s1=str.substr(0,pos); if(pos!=str.size()){ s2=str.substr(pos+1,str.size()); } int count1=0,count2=0; string res; for (auto it =vecin.begin();it!= vecin.end();it++) { int flag1=it->first.find(s1)==0 ? 1:0; int flag2; if(s2!=""){ flag2=it->second.find(s2)==0?1:0; }else if(s2==""&&it->second==""){ flag2=1; }else flag2=0; if(flag1&&flag2){count1++;count2++;res=vecout[it- vecin.begin()];} } if(count1==1 && count2==1){cout<<res<<endl;}else cout<< "unknown command" << endl; } } // 64 位输出请用 printf("%lld")