S = list(input())
T = list(input())
P = [0 for _ in range(4)]
for s in S:
    for t in T:
        B = [s,t]
        if "A" in B and not "B" in B:
            P[0] += 1
        elif "B" in B and not "A" in B:
            P[1] += 1
        elif "A" in B and "B" in B:
            P[2] += 1
        else:
            P[3] += 1
per = 100//(sum(P))
for i in range(4):
    print(per*P[i], end=" ")