题解 | #配置文件恢复#
配置文件恢复
https://www.nowcoder.com/practice/ca6ac6ef9538419abf6f883f7d6f6ee5
while True:
try:
ke = ['reset','reset board','board add','board delete','reboot backplane','backplane abort']
val = ['reset what','board fault','where to add','no board at all','impossible','install first']
s = input().split()
if len(s) < 1 or len(s) > 2:
print('unknown command')
elif len(s) == 1:
if s[0] == ke[0][:len(s[0])]:
print(val[0])
else:
print('unknown command')
else:
ls = []
for i in range(1,len(ke)):
a = ke[i].split()# board add # bo a
if s[0] == a[0][:len(s[0])] and s[1] == a[1][:len(s[1])]:
ls.append(i)
if len(ls) == 1:
print(val[ls[0]])
else:
print('unknown command')
except:
break