S = list(input()) T = list(input()) A, B, AB, O, all = 0, 0, 0, 0, 4 for Si in S: for Ti in T: child = set(Si+Ti) if "A" in child and not "B" in child: A += 1 elif not "A" in child and "B" in child: B += 1 elif "A" in child and "B" in child: AB += 1 else: O += 1 print(A*100//all, B*100//all, AB*100//all, O*100//all)