#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>

#define INPUT_FROM_FILE (0) 
#if INPUT_FROM_FILE
#include <fstream>
#endif

int main(int argc, char **argv){
	std::vector<char> bt;
	std::string buf;

#if INPUT_FROM_FILE
	std::ifstream ifs("test.txt");
	//FILE *fp = fopen("test.txt", "r");
#endif

	
#if INPUT_FROM_FILE
	while(std::getline(ifs, buf)){
#else
	while(std::getline(std::cin, buf)){
#endif
		std::istringstream stream(buf);

		std::getline(stream, buf, ',');
		std::getline(stream, buf, ',');

		if(buf == "A"){
			bt.push_back('A');
		}
		else if(buf == "B"){
			bt.push_back('B');
		}
		else if(buf == "O"){
			bt.push_back('O');
		}
		else{
			bt.push_back('C');
		}
	}
	std::cout << std::count(bt.begin(), bt.end(), 'A') << std::endl;
	std::cout << std::count(bt.begin(), bt.end(), 'B') << std::endl;
	std::cout << std::count(bt.begin(), bt.end(), 'C') << std::endl;
	std::cout << std::count(bt.begin(), bt.end(), 'O') << std::endl;
	return 0;
}

