题解 | #配置文件恢复#
配置文件恢复
https://www.nowcoder.com/practice/ca6ac6ef9538419abf6f883f7d6f6ee5
while 1:
try:
dic = {'reset':'reset what','reset board':'board fault','board add':'where to add','board delete':'no board at all','reboot backplane':'impossible','backplane abort':'install first'}
key = list(dic.keys())
s = input().split()
if len(s)==1:
if key[0].find(s[0])==0:
print('reset what')
else:
print('unknown command')
elif len(s)==2:
l = []
for i in key[1:]:
k = i.split()
if k[0].find(s[0])==0 and k[1].find(s[1])==0:
l.append(dic[i])
if len(l)==1:
print(l[0])
else:
print('unknown command')
else:
print('unknown command')
except:
break