S = input() T = input() P_A, P_B, P_AB, P_O = 0, 0, 0, 0 for s in S: for t in T: if 'A' in {s, t} and 'B' not in {s, t}: P_A += 25 elif 'B' in {s, t} and 'A' not in {s, t}: P_B += 25 elif 'A' in {s, t} and 'B' in {s, t}: P_AB += 25 else: P_O += 25 print(P_A, P_B, P_AB, P_O)