题解 | #配置文件恢复# 力争最简!
配置文件恢复
http://www.nowcoder.com/practice/ca6ac6ef9538419abf6f883f7d6f6ee5
l1=['reset','reset board','board add','board delete','reboot backplane','backplane abort'] l2=['reset what','board fault','where to add','no board at all','impossible','install first'] l3=['unknown command'] while 1: try: ml=input().split() cd1,cd2=len(ml[0]),len(ml[-1]) mmll=[] for i in l1: i1=i.split() if ml[0]==i1[0][:cd1] and ml[-1]==i1[-1][:cd2]: mmll.append(i) if len(mmll)==1: print(l2[l1.index(mmll[0])]) else: print(l3[0]) except: break