S = input() T = input() def f(s,t): global a,b,ab,o if(("A" in s or "A" in t) and ("B" not in s and "B" not in t)): a += 25 elif(("B" in s or "B" in t) and ("A" not in s and "A" not in t)): b += 25 elif(("A" in s or "A" in T) and ("A" in s or "A" in t)): ab += 25 else: o += 25 B = ["AA", "AB", "AO", "BB", "BO", "OO"] if((S in B and T in B)==False): print("WA") a = 0 b = 0 ab = 0 o = 0 f(S[0],T[0]) f(S[0],T[1]) f(S[1],T[0]) f(S[1],T[1]) print(a,b,ab,o)