题解 | 简单错误记录
简单错误记录
https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
# times 第 i 个元素存储第 i 条记录出现的次数
rec = []
times = []
while True:
try:
x, y = input().split()
# x 取路径后16位后用\分割之后的倒数第一个
x = x[-16:].split("\\")[-1]
data = x + " " + y
if data not in rec:
rec.append(data)
times.append(1)
else:
times[rec.index(data)] += 1
except:
break
for i in range(len(rec[-8:])):
print(rec[-8:][i], times[rec.index(rec[-8:][i])])

