一、题目
二、示例
三、代码
error = {}
list1 = []
while True:
try:
record = input().split('\\')[-1]
file = record.split()
if len(file[0]) >= 16:
file[0] = file[0][-16:]
if ' '.join(file) not in error.keys():
error[' '.join(file)] = 1
list1.append(' '.join(file))
else:
error[' '.join(file)] += 1
except:
break
temp = list1[-8:]
for item in temp:
print(' '.join(item.split()), error[item])
四、算法说明
将每一个输入的错误记录按照'\'
进行分割,得到文件表述file
;
将文件名称file[0]
的长度进行处理,超过 16 之后进行截取;
然后判断,新的文件表述是否包含在字典中,并进行相应的操作;
输出最后 8 个错误记录。
胡萝卜
2022年3月9日15:08:20
我不知道将去向何方,但我已在路上! |
---|
时光匆匆,虽未曾谋面,却相遇于斯,实在是莫大的缘分,感谢您的到访 ! |