题解 | #简单错误记录#
简单错误记录
http://www.nowcoder.com/practice/2baa6aba39214d6ea91a2e03dff3fbeb
def get_name(s):
s1 = s.split()[0]
s2 = s.split()[1]
name = s1.split('\\')[-1]
if len(name) > 16:
name = name[-16:]
return name,s2
a = {}
while True:
try:
name_row = get_name(input().strip())
if name_row not in a:
a[name_row] = 1
else:
a[name_row] +=1
except EOFError:
if len(a)<=8:
for i in a.keys():
print(*i,a[i])
else:
a_k = list(a.keys())[-8:]
a_v = list(a.values())[-8:]
for i in range(8):
print(*a_k[i],a_v[i])
break
s1 = s.split()[0]
s2 = s.split()[1]
name = s1.split('\\')[-1]
if len(name) > 16:
name = name[-16:]
return name,s2
a = {}
while True:
try:
name_row = get_name(input().strip())
if name_row not in a:
a[name_row] = 1
else:
a[name_row] +=1
except EOFError:
if len(a)<=8:
for i in a.keys():
print(*i,a[i])
else:
a_k = list(a.keys())[-8:]
a_v = list(a.values())[-8:]
for i in range(8):
print(*a_k[i],a_v[i])
break