s=input() t=input() d={"A":0,"B":0,"AB":0,"O":0} for i in range(2): for j in range(2): st={s[i],t[j]} if "A" in st and "B" not in st: d["A"]+=1 elif "B" in st and "A" not in st: d["B"]+=1 elif "A" in st and "B" in st: d["AB"]+=1 else: d["O"]+=1 print(d["A"]*25,d["B"]*25,d["AB"]*25,d["O"]*25)