#include <iostream>
#include <string>
using namespace std;

int main()
{
	int a = 0, b = 0, c = 0, d = 0;
	string s;

	while (cin >> s) {
		int i = 0;

		while (s[i] != ',')
			i++;

		if (s[i + 1] == 'B')
			b++;
		else if (s[i + 1] == 'O')
			d++;
		else if (s.size() == i + 3)
			c++;
		else
			a++;
	}

	cout << a << endl << b << endl << c << endl << d << endl;

	return 0;
}
