S=input() T=input() ans=[0]*4 for s in S: for t in T: blood=set([s,t]) if 'A' in blood and 'B' not in blood: ans[0]+=25 if 'B' in blood and 'A' not in blood: ans[1]+=25 if 'A' in blood and 'B' in blood: ans[2]+=25 if 'A' not in blood and 'B' not in blood: ans[3]+=25 print(*ans)