import time import random import sys # 開始時間 start = time.perf_counter() # 入力 s = input().strip() t = input().strip() # 実行時間制限 time_limit = 2.0 # 変数の初期化 baby = {"A": 0, "B": 0, "O": 0, "AB": 0} count = 0 # およそ(TL - 0.5)秒ループ while time.perf_counter() - start < time_limit - 0.5: # 試行回数 += 1 count += 1 # ランダムに取り出す x = {random.choice(s), random.choice(t)} # 問題文中の判定 if "A" in x and "B" not in x: baby["A"] += 1 elif "B" in x and "A" not in x: baby["B"] += 1 elif "A" in x and "B" in x: baby["AB"] += 1 else: baby["O"] += 1 # 割合を百分率で計算(誤差対策の為0.5を足して切り捨て) a = int(baby["A"] / count * 100 + 0.5) b = int(baby["B"] / count * 100 + 0.5) ab = int(baby["AB"] / count * 100 + 0.5) o = int(baby["O"] / count * 100 + 0.5) # 出力 print(a, b, ab, o) print(count, baby, file=sys.stderr)