题解 | #记票统计#
记票统计
https://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894
trash = input() candidates = {i: 0 for i in input().split()} trash = input() votes = input().split() candidates["Invalid"] = 0 for vote in votes: if vote in candidates: candidates[vote] += 1 else: candidates["Invalid"] += 1 for candidate in candidates: print(f"{candidate} : {candidates[candidate]}")