from itertools import product S=list(input()) T=list(input()) ans={"A":0,"B":0,"O":0,"AB":0} for s,t in product(S,T): if (s=="A" and t=="B") or (s=="B" and t=="A"): ans["AB"]+=25 elif s=="A" or t=="A": ans["A"]+=25 elif s=="B" or t=="B": ans["B"]+=25 else: ans["O"]+=25 print (ans["A"],ans["B"],ans["AB"],ans["O"])