from random import randint

N = 10**5  # モンテカルロ法の試行回数


def blood_type(s, t):
    child = [s, t]

    if child.count("A") >= 1 and child.count("B") == 0:
        return 0  # A型の場合

    elif child.count("A") == 0 and child.count("B") >= 1:
        return 1  # B型の場合

    elif child.count("A") >= 1 and child.count("B") >= 1:
        return 2  # AB型の場合

    else:
        return 3  # O型の場合


S = input()
T = input()

C = [0, 0, 0, 0]

for _ in range(N):
    s = S[randint(0, 1)]
    t = T[randint(0, 1)]

    C[blood_type(s, t)] += 1

answers = [0, 0, 0, 0]

for i in range(4):
    answers[i] = round(100 * C[i] / N)

print(*answers)