就字典的运用,初始值赋值挺难搞的
``` python []
while True:
try:
n1=int(input())
s1=list(map(str, input().split()))
n2=int(input())
s2=list(map(str, input().split()))
dic={}
for i in s1:#初始化
dic[i]=0
#dic["Invalid"]=0#第一种方式
dic.update({"Invalid":0})#第二种方式,用update,参数为字典对象
for i in s2:
if i in s1:#如果i in s1
dic[i]+=1
else:
dic["Invalid"]+=1
#print(dic)#测试用
for k,v in dic.items():
print("{0} : {1}".format(k, v))
except:
break