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