S = input() T = input() probs = [0, 0, 0, 0] A, B, AB, O = 0, 1, 2, 3 for s in S: for t in T: typ = {s, t} if 'A' in typ and 'B' in typ: probs[AB] += 25 elif 'A' in typ: probs[A] += 25 elif 'B' in typ: probs[B] += 25 else: probs[O] += 25 print(*probs)