s=input() t=input() ans=[0]*4 for e in s: for e2 in t: L=[e,e2] L.sort() if L==["O","O"]: ans[3]+=25 elif L==["A","B"]: ans[2]+=25 elif L==["A","A"] or L==["A","O"]: ans[0]+=25 else: ans[1]+=25 print(*ans)