import std.stdio, std.string, std.conv;
import std.array, std.algorithm, std.range;

void main()
{
    immutable T = ["A":0,"B":1,"AB":2,"O":3];
    int[4] c;
    foreach(v;stdin.byLine().map!(s=>T[s.split(",")[1]])) ++c[v];
    foreach(v;c) writeln(v);
}