s=input() t=input() l=[s[0]+t[0],s[0]+t[1],s[1]+t[0],s[1]+t[1]] a,b,ab,o=0,0,0,0 for i in range(4): if l[i]=='AA' or l[i]=='AO' or l[i]=='OA': a+=1 elif l[i]=='BB' or l[i]=='BO' or l[i]=='OB': b+=1 elif l[i]=='AB' or l[i]=='BA': ab+=1 else: o+=1 print(a*25,b*25,ab*25,o*25)