题解 | #记票统计#

记票统计

http://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894

while True:
    try:
        n1 = int(input())
        name = input().split()
        n2 = int(input())
        vot = input().split()
        d = {}
        for i in range(len(name)):
            d[name[i]] = 0
        d['Invalid'] = 0
        for i in vot:
            if i in d:
                d[i] += 1
            else:
                d['Invalid'] += 1
        for i in d:
            print(i + ' ' + ':' + ' ' + str(d[i]))
    except:
        break
全部评论

相关推荐

评论
点赞
1
分享
牛客网
牛客企业服务