题解 | #简单错误记录#
简单错误记录
https://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
import sys all_names = [] save={} save_list = [] for line in sys.stdin: name, size = line.split() if name+' '+size in all_names: continue else: all_names.append(name) onlyname = name.split('\\')[-1] if len(onlyname)> 16: onlyname = onlyname[-16:] if onlyname+' '+size in save.keys(): save[onlyname+' '+size]+=1 else: save[onlyname+' '+size]=1 if len(save_list)<8: save_list.append(onlyname+' '+size) else: save_list.pop(0) save_list.append(onlyname+' '+size) for i in save_list: print(i,save[i])