题解 | #查找两个字符串a,b中的最长公共子串#

配置文件恢复

http://www.nowcoder.com/practice/ca6ac6ef9538419abf6f883f7d6f6ee5

while(commands = readline()) {
  const arr = commands.split(" ");
  let command = "unknown command"
  if(arr.length === 1) {
    if('reset'.startsWith(arr[0])) {
      command = "reset what"
    }
  } else if(arr.length === 2) {
    const prev = arr[0];
    const next = arr[1];
    let resetCount = 0;
    if('reset'.startsWith(prev) && 'board'.startsWith(next)) {
      command = 'board fault'
      resetCount++;
    } 
    if ('reboot'.startsWith(prev) && 'backplane'.startsWith(next)) {
      command = 'impossible'
      resetCount++;
    }
    if ('board'.startsWith(prev) && 'add'.startsWith(next)) {
      command = 'where to add'
      resetCount++;
    }
    if ('board'.startsWith(prev) && 'delete'.startsWith(next)) {
      command = 'no board at all'
      resetCount++;
    }
    if ('backplane'.startsWith(prev) && 'abort'.startsWith(next)) {
      command = 'install first'
      resetCount++;
    }
    if(resetCount > 1) {
      command = "unknown command"
    } 
  }
  console.log(command)
}
全部评论

相关推荐

不愿透露姓名的神秘牛友
07-04 14:35
点赞 评论 收藏
分享
小浪_Coding:找硬件测试,也可兼顾软测欧, 简历还可以的 ,注意排版,项目写的有条理一点, 然后个人技能多加点, 润色好简历之后就开始沟通海投了,深圳,东莞这边做硬件相关的公司还不少, 医疗类,仪器类的都可以尝试
点赞 评论 收藏
分享
面向对象的火龙果很爱...:去吃一顿炸鸡就走
点赞 评论 收藏
分享
评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务