S=input() T=input() cnt=[0]*4 for s in S: for t in T: if s+t in ("AB","BA"): cnt[2]+=1 elif s=="O" and t=="O": cnt[3]+=1 elif "A" in s+t: cnt[0]+=1 else: cnt[1]+=1 for i in range(4): cnt[i]*=25 print(*cnt)