#include <iostream>
using namespace std;

int main()
{
 int x,y,z,a,b,ab,o;
 char w,v,q;
 while(cin>>x>>w>>v)
 {
  if(v == A;)a++;
  else if(v==B;){b++;}
  else if(v==AB;){ab++;}
  else (v==o;){o++;}
  }
cout<<a<<endl;
cout<<b<<endl;
cout<<ab<<endl;
cout<<o<<endl;
return 0;
}