S = input() T = input() child_blood_types = [0, 0, 0, 0] for i in (0, 1): for j in (0, 1): st = set() if S[i] != 'O': st.add(S[i]) if S[j] != 'O': st.add(S[j]) if st == {'A'}: child_blood_types[0] += 25 elif st == {'B'}: child_blood_types[1] += 25 elif st == {'A', 'B'}: child_blood_types[2] += 25 else: child_blood_types[3] += 25 print(*child_blood_types)