S = input() T = input() PA = 0 PB = 0 PAB = 0 PO = 0 for s in S: for t in T: types = set() types.add(s) types.add(t) if "A" in types and "B" not in types: PA += 25 elif "B" in types and "A" not in types: PB += 25 elif "A" in types and "B" in types: PAB += 25 else: PO += 25 print(PA,PB,PAB,PO)