from sys import stdin
output = '' #將資料結束後一次輸出減少耗時
for s in stdin:
if s.strip() == '': continue
pwd = s.split()
d={'1':0,'2':0,'3':0,'4':0,'5':0,'6':0,'7':0,'8':0,'9':0,'0':0}
for p in pwd:
d[p]+=1
for _ in range(int(stdin.readline())): #讀取數字行
test=stdin.readline().split()
ans=pwd.copy() #複製pwd給ans,兩者為不同對象
dis=d.copy()
ACount=0
BCount=0
for i in range(len(ans)):
if ans[i]==test[i]:
dis[ans[i]]-=1
ACount+=1
ans[i]='check'
test[i]='check'
for a in ans:
if a in test and a!='check' and dis[a]>0:
dis[a]-=1
BCount+=1
output+=f'{ACount}A{BCount}B\n'
print(output)
求各位大佬幫看一下