Problem:


血液型

ある学級の生徒の出席番号と ABO 血液型を保存したデータを読み込んで、おのおのの血液型の人数を出力するプログラムを作成してください。なお、ABO 血液型には、A 型、B 型、AB 型、O 型の４種類の血液型があります。

Input

カンマで区切られた出席番号と血液型の組が、複数行に渡って与えられます。出席番号は 1 以上 50 以下の整数、血液型は文字列 "A", "B", "AB" または "O" のいずれかです。生徒の人数は 50 を超えません。

Output

１行目に A 型の人数

２行目に B 型の人数

３行目に AB 型の人数

４行目に O 型の人数

を出力します。

Sample Input

1,B
2,A
3,B
4,AB
5,B
6,O
7,A
8,O
9,AB
10,A
11,A
12,B
13,AB
14,A

Output for the Sample Input

5
4
3
2



Sample input:
1,B
2,A
3,B
4,AB
5,B
6,O
7,A
8,O
9,AB
10,A
11,A
12,B
13,AB
14,A


Sample output:
5
4
3
2

Submission status: Wrong Answer

Solution code:
from sys import *

lis = {"A":0,"B":0,"O":0,"AB":0}
for s in stdin:
    n,t = map(str,s[:-1].split(","))
    lis[t] += 1
print lis["A"]
print lis["B"]
print lis["O"]
print lis["AB"]

Submission status: Wrong Answer

Solution code:
dic = {'A': 0, 'B': 0, 'AB': 0, 'O': 0}
while(1):
    try:
        i = raw_input()
        num, blood = i.split(',')
        dic[blood] += 1
    except:
        break
for i in dic.values():
    print i

Submission status: Wrong Answer

Solution code:
dict={"A":0, "B":0, "AB":0, "O":0}

while True:
    try:
        n, s = input().split(",")
    except:
        break
    dict[s] += 1

for i in dict.keys():
    print(dict[i])

Submission status: Wrong Answer

Solution code:
l=[0]*4
while 1:
    try:
        a,b=map(int,raw_input().split(","))
        if b=="A":
            l[0]+=1
        elif b=="B":
            l[1]+=1
        elif b=="AB":
            l[2]+=1
        else:
            l[3]+=1
    except:
        break
for i in l:
    print i

Submission status: Wrong Answer

Solution code:
a={'A':0,'B':0,'O':0,'AB':0}
while 1:
    try:
        _,b=input().split(",")
        a[b]+=1
    except:
        for i in a:print(a[i])
        break

Submission status: Wrong Answer

Solution code:
import sys
A = 0
B = 0
AB = 0
O = 0
for line in sys.stdin:
    if line == "\n":
        break
    No, b_type = line.rstrip().split(",")
    print(No, b_type)
    if b_type == "A":
        A += 1
    elif b_type == "B":
        B += 1
    elif b_type == "AB":
        AB += 1
    else:
        O += 1
print(A)
print(B)
print(AB)
print(O)

Submission status: Wrong Answer

Solution code:
import sys
A = 0
B = 0
AB = 0
O = 0
for line in sys.stdin:
    if line == "\n":
        break
    No, b_type = line.split(",")
    print(No, b_type)
    if b_type == "A\n":
        A += 1
    elif b_type == "B\n":
        B += 1
    elif b_type == "AB\n":
        AB += 1
    else:
        O += 1
print(A)
print(B)
print(AB)
print(O)

Submission status: Wrong Answer

Solution code:
a = 0
b = 0
o = 0
ab = 0
while True:
    try:
        n, bt = input().split(",")
        if bt =="A":
            a += 1
        elif bt =="B":
            b += 1
        elif bt =="O":
            o += 1
        elif bt =="AB":
            ab += 1
    except:
        break
print(a, b, o, ab, sep="\n")

Submission status: Wrong Answer

Solution code:
ac = bc = oc = abc = 0
while 1:
	try: n, bt = input().split(",")
	except: break
	if bt == "A": ac += 1
	elif bt == "B": bc += 1
	elif bt == "O": oc += 1
	elif bt == "AB": abc +=1
print(ac,"\n",bc,"\n",oc,"\n",abc,"\n")

Submission status: Wrong Answer

Solution code:
ac = bc = oc = abc = 0
while 1:
	try: n, bt = input().split(",")
	except: break
	if bt == "A": ac += 1
	elif bt == "B": bc += 1
	elif bt == "O": oc += 1
	elif bt == "AB": abc +=1
print(ac)
print(bc)
print(oc)
print(abc)

Submission status: Wrong Answer

Solution code:
blood = []
while True:
	try:
		x = map(int,raw_input().split(','))
		blood.append(x[1])
	except: break
print blood.count('A')
print blood.count('B')
print blood.count('AB')
print blood.count('O')

Submission status: Accepted

Solution code:
di = {"A":0,"B":0,"AB":0,"O":0}
while(True):
    try: di[input().split(",")[1]] += 1
    except: break
print(di["A"])
print(di["B"])
print(di["AB"])
print(di["O"])

Submission status: Accepted

Solution code:
blood = {"A":0, "B":0, "AB":0, "O":0}
try:
    while True:
        tmp = raw_input().split(",")
        blood[tmp[1]]+=1
        
except:
    print blood["A"]
    print blood["B"]
    print blood["AB"]
    print blood["O"]

Submission status: Accepted

Solution code:
btc=[0,0,0,0]
while 1:
    try:
        n,bt=list(map(str,input().split(",")))
        if bt=="A":btc[0]+=1
        if bt=="B":btc[1]+=1
        if bt=="AB":btc[2]+=1
        if bt=="O":btc[3]+=1
    except:break
for i in range(4):
    print(btc[i])

Submission status: Accepted

Solution code:
blood = [0] * 4

while True:
    try:
        b = input().split(',')[1]
        if b == 'A':
            blood[0] += 1
        elif b == 'B':
            blood[1] += 1
        elif b == 'AB':
            blood[2] += 1
        else:
            blood[3] += 1
    except:
        for b in blood: print(b)
        break

Submission status: Accepted

Solution code:
d = {};
d["A"] = 0;
d["B"] = 0;
d["AB"] = 0;
d["O"] = 0;

while True:
 try:
  b = raw_input().strip().split(",")[1]
  d[b] += 1;
 except:
  break;

print d["A"]
print d["B"]
print d["AB"]
print d["O"]

Submission status: Accepted

Solution code:
from sys import *

lis = {"A":0,"B":0,"O":0,"AB":0}
for s in stdin:
    n,t = map(str,s[:-1].split(","))
    lis[t] += 1
print lis["A"]
print lis["B"]
print lis["AB"]
print lis["O"]

Submission status: Accepted

Solution code:
dic = {'A': 0, 'B': 1, 'AB': 2, 'O': 3}
sumlist = [0, 0, 0, 0]
while(1):
    try:
        i = raw_input()
        num, blood = i.split(',')
        sumlist[dic[blood]] += 1
    except:
        break
for i in sumlist:
    print i

Submission status: Accepted

Solution code:
import sys
f = sys.stdin

blood_types = ('A', 'B', 'AB', 'O')
blood_count = {type:0 for type in blood_types}
for line in f:
    id, blood_type = line.strip().split(',')
    blood_count[blood_type]  += 1

for blood_type in blood_types:
    print(blood_count[blood_type])

Submission status: Accepted

Solution code:
Blist = ['A','B','AB','O']
dic = {}
for i in Blist:
    dic[i] = 0
    
while True:
    try:
        StNum,BT=raw_input().split(',')
    except EOFError:
        break
    
    dic[BT] += 1

for k in Blist:
    print dic[k]

Submission status: Accepted

Solution code:
l=["A","B","AB","O"]
dict={"A":0, "B":0, "AB":0, "O":0}

while True:
    try:
        n, s = input().split(",")
    except:
        break
    dict[s] += 1

for i in l:
    print(dict[i])

Submission status: Accepted

Solution code:
import sys

blood = [0,0,0,0]
for line in sys.stdin:
    b = line.split(',')[1].rstrip()
    if b == 'A':
        blood[0] = blood[0] + 1
    elif b == 'B':
        blood[1] = blood[1] + 1
    elif b == 'AB':
        blood[2] = blood[2] + 1
    elif b == 'O':
        blood[3] = blood[3] + 1
else:
    for num in blood:
        print num

Submission status: Accepted

Solution code:
l=[0]*4
while 1:
    try:
        a,b=map(str,raw_input().split(","))
        if b=="A":
            l[0]+=1
        elif b=="B":
            l[1]+=1
        elif b=="AB":
            l[2]+=1
        else:
            l[3]+=1
    except:
        break
for i in l:
    print i

Submission status: Accepted

Solution code:
import sys
a,b,o,ab = 0,0,0,0
for line in sys.stdin.readlines():
  i,t = line.split(',')
  if t == 'A\n':
    a += 1
  if t == 'B\n':
    b += 1
  if t == 'O\n':
    o += 1
  if t == 'AB\n':
    ab += 1
print(a)
print(b)
print(ab)
print(o)

Submission status: Accepted

Solution code:
cnt_A=0
cnt_B=0
cnt_O=0
cnt_AB=0
while True:
	try:
		x,y=input().split(',')
		if y=='A':
			cnt_A+=1
		elif y=='O':
			cnt_O+=1
		elif y=='B':
			cnt_B+=1
		else:
			cnt_AB+=1
	except EOFError:
		break

print(cnt_A)
print(cnt_B)
print(cnt_AB)
print(cnt_O)

Submission status: Accepted

Solution code:
import sys
import collections as col
num = []
for line in sys.stdin:
	tako = line[:-1].split(",")
	num.append(tako[1])
tako = col.Counter(num)
a = tako["O"]
tako["O"] = tako["AB"]
tako["AB"] = a
for i in tako.items():
	print i[1]

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys

dic = {'A':0, 'B':0, 'AB':0, 'O':0}
for line in sys.stdin:
    id, type = map(str, line.split(','))
    type = type[:len(type)-1]
    dic[type] += 1
print dic['A']
print dic['B']
print dic['AB']
print dic['O']

Submission status: Accepted

Solution code:
data = []
grps = ['A', 'B', 'AB', 'O']
while True:
    try:
        data += [list(input().split(','))[1]]
    except:
        break
for grp in grps:
    print(data.count(grp))

Submission status: Accepted

Solution code:
A_Num = 0
B_Num = 0
O_Num = 0
AB_Num = 0
while True:
    try:
        N,Cha = map(str,input().split(","))
        if Cha == "A":
            A_Num += 1
        elif Cha == "B":
            B_Num +=1
        elif Cha == "O":
            O_Num += 1
        else:
            AB_Num += 1
    except EOFError:
        print(A_Num)
        print(B_Num)
        print(AB_Num)
        print(O_Num)
        break

Submission status: Accepted

Solution code:
import sys

man = []
blood = ["A","B","AB","O"]
for line in sys.stdin:
    man.append(line.strip().split(",")[1])

for b in blood:
    print(man.count(b))

Submission status: Accepted

Solution code:
from collections import defaultdict as dd
bloods=dd(int)
while True:
    try:
        x,y=input().split(",")
    except:
        break
    bloods[y]+=1
print(bloods["A"])
print(bloods["B"])
print(bloods["AB"])
print(bloods["O"])

Submission status: Accepted

Solution code:
a={'A':0,'B':0,'O':0,'AB':0}
while 1:
    try:
        _,b=input().split(",")
        a[b]+=1
    except:
        for i in ['A','B','AB','O']:print(a[i])
        break

Submission status: Accepted

Solution code:
d = []
while True:
    try:
        n,b = input().split(',')
        d.append(b)
    except EOFError:
        break

A,B,O,AB = [],[],[],[]
for i in range(len(d)):
    if d[i] == 'A':
        A.append(i)
    elif d[i] == 'B':
        B.append(i)
    elif d[i] == 'AB':
        AB.append(i)
    elif d[i] == 'O':
        O.append(i)
    else:
        print('error')
print(len(A))
print(len(B))
print(len(AB))
print(len(O))

Submission status: Accepted

Solution code:
hist = {'A':0,'B':0,'AB':0,'O':0}
while True:
    try:
        i,b = input().strip().split(',')
        hist[b] += 1
    except EOFError:
        break

print("%d\n%d\n%d\n%d" % (hist['A'],hist['B'],hist['AB'],hist['O']))

Submission status: Accepted

Solution code:
import sys
a = 0
b = 0
ab = 0
o = 0
for i in sys.stdin.readlines():
    if i.find(",AB") > -1:
        ab += 1
    elif i.find(",B") > -1:
        b += 1
    elif i.find(",A") >-1:
        a += 1
    else:
        o += 1
print(a)
print(b)
print(ab)
print(o)

Submission status: Accepted

Solution code:
cnt = {'A':0,'B':0,'AB':0,'O':0}
while True:
    try:
        n,b = input().split(',')
        cnt [b] += 1
    except EOFError:
        break
print(cnt ['A'])
print(cnt ['B'])
print(cnt ['AB'])
print(cnt ['O'])

Submission status: Accepted

Solution code:
import sys

if __name__=='__main__':
    indat = [l[:-1].split(',')[1] for l in sys.stdin]
    for l in map(lambda x: indat.count(x), ['A','B','AB','O']): print l

Submission status: Accepted

Solution code:
no = [0]*4
while True:
    try:
        bt = input().split(",")[1]
        if bt=="A": no[0] += 1
        if bt=="B": no[1] += 1
        if bt=="AB": no[2] += 1
        if bt=="O": no[3] += 1
    except EOFError: break
print(no[0])
print(no[1])
print(no[2])
print(no[3])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

import sys
import os
import math
import itertools

d = {}
d['A'] = 0
d['B'] = 0
d['AB'] = 0
d['O'] = 0

for s in sys.stdin:
    s = s.strip()
    type = s.split(',')[-1]
    d[type] += 1

print(d['A'])
print(d['B'])
print(d['AB'])
print(d['O'])

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0049
Blood Groups
"""
import sys
from collections import Counter


def main(args):
    members = []
    for line in sys.stdin:
        _, blood_type = line.strip().split(',')  # ??\??????????????????????????????????¶????(????????????)???????????????
        members.append(blood_type)

    # ?????????????¨?
    blood_type_counter = Counter(members)  # ??????????????????????????§????????????????¨???????
    print(blood_type_counter['A'])  # ?????¨?????????????´????????????????KeyError??§?????????0??????????????????????????§?????????????????????????????°OK
    print(blood_type_counter['B'])
    print(blood_type_counter['AB'])
    print(blood_type_counter['O'])


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

Solution code:
A, B, O, AB = 0, 0, 0, 0
while True :
    try    : 
        number, blood = input().split(',')
        if   blood == 'A' : A += 1
        elif blood == 'B' : B += 1
        elif blood == 'O' : O += 1
        else : AB += 1
    except : break
print(A)
print(B)
print(AB)
print(O)

Submission status: Accepted

Solution code:
d = {"A": 0, "AB": 0, "B": 0, "O": 0}
flag = 1
while flag:
    try:
        _, blood_type = input().split(',')
        d[blood_type] += 1
    except:
        for blood_type in ["A", "B", "AB", "O"]:
            print(d[blood_type])
        flag = 0

Submission status: Accepted

Solution code:
d = []
flag = 1
while flag:
    try:
        _, blood_type = input().split(',')
        d.append(blood_type)
    except:
        for blood_type in ["A", "B", "AB", "O"]:
            print(d.count(blood_type))
        flag = 0

Submission status: Accepted

Solution code:
import sys
blood = {"A": 0, "B": 0, "AB": 0, "O": 0}
for line in sys.stdin:
    if line == "\n":
        break
    no, b = line.rstrip().split(",")
    blood[b] += 1
print(blood["A"])
print(blood["B"])
print(blood["AB"])
print(blood["O"])

Submission status: Accepted

Solution code:
# Aizu Problem 0049: Blood Group
#
import sys, math, os

# read input:
PYDEV = os.environ.get('PYDEV')
if PYDEV=="True":
    sys.stdin = open("sample-input.txt", "rt")

counts = {'A': 0, 'B': 0, 'AB': 0, 'O': 0}
for line in sys.stdin:
    no, group = line.strip().split(',')
    counts[group] += 1

for group in ['A', 'B', 'AB', 'O']:
    print(counts[group])

Submission status: Accepted

Solution code:
import sys

d = {"A": 0, "B": 1, "AB": 2, "O": 3}
L = [0] * 4

for line in sys.stdin:
  try:
    n, t = [i.rstrip() for i in line.split(',')]
    L[d[t]] += 1
  except:
    break
for l in L:
  print(l)

Submission status: Accepted

Solution code:
def main():
    a_count = 0
    b_count = 0
    ab_count = 0
    o_count = 0
    while True:
        try:
            x,y = map(str,input().split(','))
            if y == 'A':
                a_count += 1
            elif y == 'B':
                b_count += 1
            elif y == 'AB':
                ab_count += 1
            else:
                o_count += 1
        except EOFError:
            break
    print('{}\n{}\n{}\n{}'.format(a_count,b_count,ab_count,o_count))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
a = 0
b = 0
o = 0
ab = 0
while True:
    try:
        n, bt = input().split(",")
        if bt =="A":
            a += 1
        elif bt =="B":
            b += 1
        elif bt =="O":
            o += 1
        elif bt =="AB":
            ab += 1
    except:
        break
print(a, b, ab, o, sep="\n")

Submission status: Accepted

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(input())
        except EOFError:
            break

students = ["" for i in range(51)]

N = list(get_input())
for l in range(len(N)):
    data = N[l].split(",")
    num = int(data[0])
    t = data[1]
    students[num] = t

A,B,AB,O = 0,0,0,0
for i in range(1,51):
    if students[i] == "A":
        A += 1
    elif students[i] == "AB":
        AB += 1
    elif students[i] == "B":
        B += 1
    elif students[i] == "O":
        O += 1
print(A)
print(B)
print(AB)
print(O)

Submission status: Accepted

Solution code:
import sys
d={b+'\n':0 for b in['A','B','AB','O']}
for e in sys.stdin:d[e.split(',')[1]]+=1
for b in d:print(d[b])

Submission status: Accepted

Solution code:
import sys
d={'A':0,'B':0,'AB':0,'O':0}
for e in sys.stdin:d[e.strip().split(',')[1]]+=1
for b in d:print(d[b])

Submission status: Accepted

Solution code:
import sys
d={'A\n':0,'B\n':0,'AB\n':0,'O\n':0}
for e in sys.stdin:d[e.split(',')[1]]+=1
for b in d:print(d[b])

Submission status: Accepted

Solution code:
import sys
d={'A':0,'B':0,'AB':0,'O':0}
for e in sys.stdin:d[e.split(',')[1][:-1]]+=1
for b in d:print(d[b])

Submission status: Accepted

Solution code:
import sys
m=[e.split(',')[1]for e in sys.stdin]
for b in['A','B','AB','O']:print(m.count(b+'\n'))

Submission status: Accepted

Solution code:
import sys
m=[e.split(',')[1][:-1]for e in sys.stdin]
for b in['A','B','AB','O']:print(m.count(b))

Submission status: Accepted

Solution code:
b = {"A":0, "B":0, "O":0, "AB":0}
while 1:
    try:b[input().split(",")[1]] += 1
    except:break
print(b["A"])
print(b["B"])
print(b["AB"])
print(b["O"])

Submission status: Accepted

Solution code:
from collections import Counter

dic = Counter()

while True:
  try:
    n, t = input().split(",")
    dic[t] += 1
  except EOFError:
    break

for s in ("A", "B", "AB", "O"):
  print(dic[s])

Submission status: Accepted

Solution code:
from collections import Counter
import sys
d=Counter([i.split(",")[1].strip() for i in sys.stdin])
[print(d[i]) for i in ["A","B","AB","O"]]

Submission status: Accepted

Solution code:
# AOJ 0049: Blood Groups
# Python3 2018.6.14 bal4u

blood = ["A","B","AB","O"]
cnt = [0]*4

while True:
	try:
		k, b = list(input().split(','))
	except EOFError:
		break
		
	cnt[blood.index(b)] += 1
print(*cnt, sep='\n')

Submission status: Accepted

Solution code:
ac = bc = oc = abc = 0
while 1:
	try: n, bt = input().split(",")
	except: break
	if bt == "A": ac += 1
	elif bt == "B": bc += 1
	elif bt == "O": oc += 1
	elif bt == "AB": abc +=1
print(ac)
print(bc)
print(abc)
print(oc)

Submission status: Accepted

Solution code:
import sys
from collections import Counter

counter = Counter()
for (_, t) in (l.strip().split(",") for l in sys.stdin.readlines()):
    counter[t] += 1

for t in "A B AB O".split():
    print(counter[t])

Submission status: Accepted

Solution code:
dic = {'A': 0, 'B': 0, 'AB': 0, 'O': 0}

while True:
    try:
        s = raw_input()
        sp = s.split(',')
        dic[ sp[1] ] += 1;
        
    except EOFError:
        print "%d\n%d\n%d\n%d" % (dic['A'], dic['B'], dic['AB'], dic['O'])
        break

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# coding: utf-8

import sys


def main():
    params = [line.split(",")[1].replace("\n", "") for line in sys.stdin.readlines()]
    print params.count("A")
    print params.count("B")
    print params.count("AB")
    print params.count("O")

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
z,x,c,v=0,0,0,0
while True:
  try:
    q,w = map(str,raw_input().split(","))
    if w == "A":z+=1
    elif w == "B":x+=1
    elif w =="AB":c+=1
    elif w =="O": v+=1
  except EOFError: 
    print "%d\n%d\n%d\n%d"%(z,x,c,v)
    break

Submission status: Accepted

Solution code:
import sys
type=["A","B","AB","O"]
list=[line.strip().split(",")[1] for line in sys.stdin.readlines()]
for i in type:
    print list.count(i)

Submission status: Accepted

Solution code:
blood = []
while True:
	try:
		x = map(str,raw_input().split(','))
		blood.append(x[1])
		continue
	except: break
print blood.count('A')
print blood.count('B')
print blood.count('AB')
print blood.count('O')

Submission status: Accepted

Solution code:
bt = {"A":0, "B":0, "AB":0, "O":0}
while True:
    try:
        i, _bt = raw_input().split(",")
    except EOFError as e:
        break
    bt[_bt] += 1
print(bt["A"])
print(bt["B"])
print(bt["AB"])
print(bt["O"])

Submission status: Accepted

Solution code:
bt = {"A":0, "B":0, "AB":0, "O":0}
while True:
    try:
        i, _bt = raw_input().split(",")
    except EOFError as e:
        break
    bt[_bt] += 1
print("%d\n%d\n%d\n%d" % (bt["A"], bt["B"], bt["AB"], bt["O"]))

Submission status: Accepted

Solution code:

import sys


blood_types = { 'A': 0, 'B': 0, 'AB': 0, 'O': 0 }

for line in sys.stdin:
    num, blood_type = line.rstrip('\n').split(',')
    blood_types[blood_type] += 1
for type in ['A', 'B', 'AB', 'O']:
    print blood_types[type]

Submission status: Accepted

Solution code:
na = 0
nb = 0
no = 0
nab = 0

while True:
    try:

        a,b = map(str,raw_input().split(","));

        if b == "A":
            na += 1
        elif b == "B":
            nb += 1
        elif b == "O":
            no += 1
        elif b == "AB":
            nab += 1

    except EOFError:
        break

print na
print nb
print nab
print no

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin
from collections import Counter

cnt = Counter()
for line in stdin:
    blood = line.strip().split(',')[1]
    cnt[blood] += 1

for blood in ('A', 'B', 'AB', 'O'):
    print(cnt[blood])

Submission status: Accepted

Solution code:
import sys

b = []
for s in sys.stdin:
    b.append(s.rstrip().split(',')[1])
print b.count('A')
print b.count('B')
print b.count('AB')
print b.count('O')

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
import sys

A="A"
B="B"
AB=A+B
O="O"
N="\n"

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

Submission status: Accepted

Solution code:
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]

Submission status: Accepted

Solution code:
import sys

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

Submission status: Accepted

Solution code:
a, b, o, ab = 0, 0, 0, 0
while True:
    try:
        n, abo = map(str, raw_input().split(","))
        if abo == "A":
            a += 1
        elif abo == "B":
            b += 1
        elif abo == "O":
            o += 1
        else:
            ab += 1
    except:
        break
    
print a
print b
print ab
print o

Submission status: Accepted

Solution code:
try:
    a = ['A', 'B', 'AB', 'O']
    b = {s: 0 for s in a}
    while True:
        b[raw_input().split(',')[1]] += 1
except EOFError:
    pass
for s in a:
    print b[s]

Submission status: Accepted

Solution code:
from collections import Counter

blood = Counter()
while 1:
    try:
        a, b = raw_input().split(',')
    except EOFError:
        break
    blood[b] += 1
for b in ['A', 'B', 'AB', 'O']:
    print blood[b]

Submission status: Accepted

Solution code:
A = 0
B = 0
AB = 0
O = 0
while True:
    try:
        n, blood = input().split(',')
    except:
        break
    if blood=='A':
        A += 1
    if blood=='B':
        B += 1
    if blood=='AB':
        AB += 1
    if blood=='O':
        O += 1
print(A)
print(B)
print(AB)
print(O)

Submission status: Accepted

Solution code:
A = 0
B = 0
AB = 0
O = 0

while True:
    try:
        n, t = input().split(',')
        if t == 'A':
            A += 1
        elif t == 'B':
            B += 1
        elif t == 'AB':
            AB += 1
        else:
            O += 1

    except EOFError:
        break

print(A)
print(B)
print(AB)
print(O)

Submission status: Accepted

Solution code:
lit=[]
while True:
    try:
        lit.append(input())
    except EOFError:
        break
A=0
B=0
O=0
AB=0
for i in lit:
    i=i.split(',')
    if i[1]=='AB':
        AB+=1
    elif i[1]=='B':
        B+=1
    elif i[1]=='O':
        O+=1
    else:
        A+=1
print(A,B,AB,O,sep='\n')

Submission status: Accepted

Solution code:
A = 0
B = 0
AB = 0
O = 0
while True :
    try :
        n, blood = input().split(",")
        if blood == "A" :
            A += 1
        elif blood == "B" :
            B += 1
        elif blood == "AB" :
            AB += 1
        elif blood == "O" :
            O += 1
        
    except EOFError :
        break

print(A)
print(B)
print(AB)
print(O)

Submission status: Accepted

Solution code:
import sys
readlines = sys.stdin.readlines
write = sys.stdout.write
def solve():
    C = {}
    for line in readlines():
        a, b = line.strip().split(",")
        C[b] = C.get(b, 0) + 1
    write("%d\n" % C.get("A", 0))
    write("%d\n" % C.get("B", 0))
    write("%d\n" % C.get("AB", 0))
    write("%d\n" % C.get("O", 0))
solve()

Submission status: Accepted

Solution code:
kata = [] #空リスト作成
try: #ここから下でエラーを拾う
    while True: #無限ループ
        a,b = input().split(",") #標準入力
        kata.append(b) #型の方をリストに格納する
except EOFError: #EOFErrorを拾う
    print(kata.count("A")) #A型の人数を出力
    print(kata.count("B")) #B型の人数を出力
    print(kata.count("AB")) #AB型の人数を出力
    print(kata.count("O")) #O型の人数を出力

Submission status: Accepted

Solution code:
import sys

ans = {
    'A':0,
    'B':0,
    'AB':0,
    'O':0,
}

for line in map(str.rstrip, sys.stdin):
    if line == '':
        break
    a,b = line.split(',')
    ans[b] +=1
for val in ans.values():
    print(val)

Submission status: Accepted

Solution code:
sum = [0,0,0,0]
while 1:
    try:
        num, blood = (str(x) for x in input().split(','))
        index = 0
        if blood == "B":
            index = 1
        elif blood == "AB":
            index = 2
        elif blood == "O":
            index = 3
        sum[index] += 1
    except EOFError:
        break
for i in sum :
    print(i)

Submission status: Accepted

Solution code:
m = {'A':0, 'B':0, 'AB':0, 'O':0}
while True:
    try:
        a,b = list(input().split(','))
    except:
        break
    if b == 'A':    m['A']+=1
    if b == 'B':    m['B']+=1
    if b == 'AB':   m['AB']+=1
    if b == 'O':    m['O']+=1
print(m['A'],m['B'],m['AB'],m['O'], sep = '\n')

Submission status: Accepted

Solution code:

L = []
while True:
    try:
        n, t = input().split(",")
        L.append(t)
    except EOFError:
        break

for i in ["A","B", "AB", "O" ]:
    print(L.count(i))

Submission status: Accepted

Solution code:
t = {'A': 0, 'B': 0, 'AB': 0, 'O': 0}
while 1:
    try:
        n, c = input().split(',')
        t[c] += 1

    except:
        for i in t.values():
            print(i)
        break

Submission status: Accepted

Solution code:
groups = {'A':0, 'B':0, 'AB':0, 'O':0}

try:
    while True:
        temp = [str(i) for i in input().split(',')]
        groups[temp[1]] += 1
except Exception:
    for i in groups.values():
        print(i)

Submission status: Accepted

Solution code:
# coding=utf-8

###
### for atcorder program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
        except EOFError:
            break
    return N

def conv(s):
    num = 3
    if s == 'A':
        num = 0
    elif s == 'B':
        num = 1
    elif s == 'AB':
        num = 2
    return num

N = get_input()

K = [0,0,0,0]

for i in N:
    gomi, ketsu = [x for x in i.split(',')]
    K[conv(ketsu)] += 1

for i in K:
    print(i)

Submission status: Accepted

Solution code:
if __name__ == '__main__':

	ans = []
	while True:
		try:
			n,b = input().split(",")
			ans.append(b)
		except EOFError:
			break

	print(ans.count("A"))
	print(ans.count("B"))
	print(ans.count("AB"))
	print(ans.count("O"))

Submission status: Accepted

Solution code:
a = [0, 0, 0, 0]
aa = ["A", "B", "AB", "O"]
while True:
  try:
    s = input()
  except:
    break
  b, c = s.split(",")
  a[aa.index(c)] += 1
for i in range(4):
  print(a[i])

Submission status: Accepted

Solution code:
blood={"A":0,"B":0,"AB":0,"O":0}
while True:
    try:
        num_1,num_2=list(input().split(","))
        blood[num_2] +=1        
    except:
        for i in blood:print(blood[i])
        break

Submission status: Accepted

Solution code:
blood = dict(zip(["A","B","AB","O"],[0,0,0,0]))

while(1):
    try:
        i,j = [k for k in input().split(",")]
        for k in ["A","B","AB","O"]:
            if j == k:
                blood[k] = blood[k] + 1
    except EOFError:
        print(blood["A"]);print(blood["B"]);print(blood["AB"]);print(blood["O"])
        break

Submission status: Accepted

Solution code:
a = 0
b = 0
o = 0
ab = 0
while 1:
    try:
        num, blood = map(str, input().split(","))
    except:
        break

    if blood == "A":
        a += 1
    elif blood == "B":
        b += 1
    elif blood == "O":
        o += 1
    else:
        ab += 1

print(a)
print(b)
print(ab)
print(o)

Submission status: Accepted

Solution code:
A, B, AB, O = 0, 0, 0, 0
while True:
    try: n = input().split(',')
    except: break
    
    if n[-1] == 'A':
        A += 1
    elif n[-1] == 'B':
        B += 1
    elif n[-1] == 'AB':
        AB += 1
    elif n[-1] == 'O':
        O += 1

print('{}\n{}\n{}\n{}'.format(A, B, AB, O))

Submission status: Runtime Error

Solution code:
d = {};
d["A"] = 0;
d["B"] = 0;
d["AB"] = 0;
d["O"] = 0;

while True:
 b = raw_input().strip().split(",")[1]
 d[b] += 1;

print d["A"]
print d["B"]
print d["AB"]
print d["O"]

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import sys

dic = {'A':0, 'B':0, 'AB':0, 'O':0}
for line in sys.stdin:
    id, type = map(int, line.split(','))
    dic[type] += 1
for key in dic:
    print dic[key]

Submission status: Runtime Error

Solution code:
a = 0
b= 0
ab = 0
o = 0
n  = 0
while n < 15:
    temp = input.split(",")[1]
    if 'A' in temp:
        a += 1
    elif 'B' in temp:
        b += 1
    elif 'AB' in temp:
        ab += 1
    elif'O' in temp:
        o += 1
    print a
    print b
    print ab
    print o