S = input() T = input() a = b = ab = o = 0 for s in S: for t in T: if s==t=='O': o += 25 elif sorted((s,t))==['A','B']: ab += 25 elif s=='A' or t=='A': a += 25 else: b += 25 print(a,b,ab,o)