let str; const k = ['reset', 'reset board', 'board add', 'board delete', 'reboot backplane', 'backplane abort'] const t = ['reset what', 'board fault', 'where to add', 'no board at all', 'impossible', 'install first'] while(str = readline()){ let target = [] let arr = str.split(' '); // let reg = '/^' + arr.map(v => `${v}[a-z]*`).join('\\s') + '$/g'; let reg = new RegExp('^' + arr.map(v => `${v}[a-z]*`).join('[ ]') + '$') let res = k.filter((v,k)=>{ let use = reg.test(v) if(use){ target.push(k) } return use; }) if (!res.length || res.length >= 2) { console.log('unknown command') } else { console.log(t[target[0]]) } }