import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.math;

void main(){

    int[4] bty;
    while(true){
	auto s = readln();
	if(stdin.eof()) break;
	auto s1 = split(chomp(s),',');
	if(s1[1]=="AB") s1[1] = "C";
	if(s1[1]=="O") s1[1] = "D";
	bty[to!int (to!char(s1[1]) - 'A')]++;
    }
    foreach(i;bty) writeln(i);
}