题解 | #记票统计#
记票统计
https://www.nowcoder.com/practice/3350d379a5d44054b219de7af6708894
n = int(input()) s = input().split() m = int(input()) piao = input().split() dic_piao = {'Invalid': 0} for i in s: dic_piao[i] = 0 for i in piao: try: dic_piao[i] += 1 except: dic_piao['Invalid'] += 1 s.append('Invalid') for i in s: print('{} : {}'.format(i, dic_piao[i]))