s=input()
t=input()

x=[0]*4

for i in s:
    for j in t:
        st=set([i,j])
        if "A"in st and "B"not in st:x[0]+=1
        elif "B"in st and "A"not in st:x[1]+=1
        elif "A"in st and "B"in st:x[2]+=1
        else:x[3]+=1
t=sum(x)

for i in range(4):
    x[i]=100*x[i]//t

print(*x)