题解 | #HJ94 记票统计#
记票统计
http://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894
while True:
try:
n = int(input())
candidates = input().split()
m = int(input())
votes = input().split()
invalid = 0
counts = [0] * len(candidates)
for i in range(m):
if votes[i] in candidates:
counts[candidates.index(votes[i])] += 1
else:
invalid += 1
for i in range(n):
print(f"{candidates[i]} : {counts[i]}")
print(f"Invalid : {invalid}")
except:
break