x = list(input()) y = list(input()) box = [0 for _ in range(4)] A = ("AA", "AO") B = ("BB", "BO") AB = "AB" for a in x: for b in y: t = sorted([a, b]) t = "".join(t) if t == AB: box[2] += 1 elif t in A: box[0] += 1 elif t in B: box[1] += 1 else: box[3] += 1 ansl = [] for v in box: p = v * 100 // 4 ansl.append(p) print(*ansl)