#include <iostream>
#include <string>

using namespace std;

int main() {
  int res[4] = {};
  while (true) {
    string tmp;
    if (not getline(cin, tmp, ','))
      break;
    getline(cin, tmp);

    if (tmp == "A")
      ++res[0];
    else if (tmp == "B")
      ++res[1];
    else if (tmp == "AB")
      ++res[2];
    else
      ++res[3];
  }

  for (auto &v : res)
    cout << v << endl;
}
