import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;

void main()
{
	int[4] type;
	foreach (line; stdin.byLine) {
		auto st = line.split(",");
		if (st[1] == "A") type[0]++;
		else if (st[1] == "B") type[1]++;
		else if (st[1] == "O") type[3]++;
		else type[2]++;
	}
	foreach (t; type) {
		t.writeln;
	}
}