import sys



L=["A","B","AB","O"]

b={}

for e in L:

    b[e]=0

for s in sys.stdin:

    i = s[s.index(',')+1:-1]

    b[i]+=1

for e in L:

    print(b[e])
import sys



b=[s.split(',')[1][:-1] for s in sys.stdin]

for e in ["A","B","AB","O"]:

    print(b.count(e))
import sys

L = ["A", "B", "AB", "O"]
b = {}
for e in L:
    b[e] = 0
for s in sys.stdin:
    i = s[s.index(",") + 1 : -1]
    b[i] += 1
for e in L:
    print(b[e])

import sys

b = [s.split(",")[1][:-1] for s in sys.stdin]
for e in ["A", "B", "AB", "O"]:
    print(b.count(e))

-L = ["A", "B", "AB", "O"] -b = {} -for e in L: -    b[e] = 0 -for s in sys.stdin: -    i = s[s.index(",") + 1 : -1] -    b[i] += 1 -for e in L: -    print(b[e]) +b = [s.split(",")[1][:-1] for s in sys.stdin] +for e in ["A", "B", "AB", "O"]: +    print(b.count(e))