S = input() T = input() baby = [] for s in S: for t in T: baby.append(s + t) P = [0, 0, 0, 0] for b in baby: if 'A' in b and 'B' not in b: P[0] += 1 elif 'B' in b and 'A' not in b: P[1] += 1 elif 'A' in b and 'B' in b: P[2] += 1 else: P[3] += 1 print(*[x * 100 // 4 for x in P])