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