# 2 x 2の組み合わせを全探索。問題文定義どおりの方法でカウント S = input() T = input() A, B, AB, O = 0, 0, 0, 0 for s in S: for t in T: g = {s,t} if "A" in g and "B" not in g: A += 25 elif "B" in g and "A" not in g: B += 25 elif "A" in g and "B" in g: AB += 25 else: O += 25 print(A,B,AB,O)