S = input()
T = input()


def f(a, b):
    s = {a, b}
    if 'A' in s and 'B' in s:
        return 'AB'
    if 'A' in s:
        return 'A'
    if 'B' in s:
        return 'B'
    return 'O'


res = {'A': 0, 'B': 0, 'AB': 0, 'O': 0}
for c1 in S:
    for c2 in T:
        res[f(c1, c2)] += 1

ans = []
for a in ['A', 'B', 'AB', 'O']:
    x = res[a] / 4 * 100
    ans.append(int(x))

print(*ans)