#include<iostream>
#include<string.h>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
string s,s1,s2,s3,s4;//一个花色最多13张
cin>>s;
int a=13,b=13,c=13,d=13;
s1=s.substr(0,3);
s2=s.substr(3,3);
s3=s.substr(6,3);
s4=s.substr(9,3);
if(s1==s2 || s1==s3 || s1==s4 || s2==s3 || s2==s4 || s3==s4)
{
cout<<"GRESKA";
return 0;
}
s1=s.substr(1,2);
s2=s.substr(4,2);
s3=s.substr(7,2);
s4=s.substr(10,2);
if(s[0]=='P')
a-=1;
if(s[0]=='K')
b-=1;
if(s[0]=='H')
c-=1;
if(s[0]=='T')
d-=1;
if(s[3]=='P')
a-=1;
if(s[3]=='K')
b-=1;
if(s[3]=='H')
c-=1;
if(s[3]=='T')
d-=1;
if(s[6]=='P')
a-=1;
if(s[6]=='K')
b-=1;
if(s[6]=='H')
c-=1;
if(s[6]=='T')
d-=1;
if(s[9]=='P')
a-=1;
if(s[9]=='K')
b-=1;
if(s[9]=='H')
c-=1;
if(s[9]=='T')
d-=1;
cout<<a<<" "<<b<<" "<<c<<" "<<d;
return 0;
}