def main(): s = input() t = input() b = {'A': 0, 'B': 0, 'AB': 0, 'O': 0} for x in s: for y in t: st = {x, y} flg = False if 'A' in st and 'B' not in st: b['A'] += 1 flg = True if 'B' in st and 'A' not in st: b['B'] += 1 flg = True if 'A' in st and 'B' in st: b['AB'] += 1 flg = True if not flg: b['O'] += 1 d = 0 for k in b: d += b[k] print(f'{b['A'] * 100 // d} {b['B'] * 100 // d}' f' {b['AB'] * 100 // d} {b['O'] * 100 // d}') if __name__ == '__main__': main()