#include
#include
using namespace std;
string a;
int p,k,h,t;
int main () {
cin >> a;
p=13;
k=13;
h=13;
t=13;
if ((a[0]==a[3] and a[1]==a[4] and a[2]==a[5]) or (a[0]==a[6] and a[1]==a[7] and a[2]==a[8]) or (a[0]==a[9] and a[1]==a[10] and a[2]==a[11]) or (a[3]==a[6] and a[4]==a[7] and a[5]==a[8]) or
(a[3]==a[9] and a[4]==a[10] and a[5]==a[11]) or (a[6]==a[9] and a[7]==a[10] and a[8]==a[11])) {cout << "GRESKA";return 0;}
if (a[0]=='P' and a[3]=='P' and a[6]=='P' and a[9]=='P') cout << p - 4<<" ";
else
if (a[0]=='P' and a[3]=='P' and a[6]=='P' and a[9]!='P') cout << p - 3<<" ";
else
if (a[0]=='P' and a[3]=='P' and a[6]!='P' and a[9]=='P') cout << p - 3<<" ";
else
if (a[0]=='P' and a[3]!='P' and a[6]=='P' and a[9]=='P') cout << p - 3<<" ";
else
if (a[0]!='P' and a[3]=='P' and a[6]=='P' and a[9]=='P') cout << p - 3<<" ";
else
if (a[0]=='P' and a[3]=='P' and a[6]!='P' and a[9]!='P') cout << p - 2<<" ";
else
if (a[0]=='P' and a[3]!='P' and a[6]!='P' and a[9]=='P') cout << p - 2<<" ";
else
if (a[0]!='P' and a[3]!='P' and a[6]=='P' and a[9]=='P') cout << p - 2<<" ";
else
if (a[0]!='P' and a[3]=='P' and a[6]=='P' and a[9]!='P') cout << p - 2<<" ";
else
if (a[0]!='P' and a[3]=='P' and a[6]!='P' and a[9]=='P') cout << p - 2<<" ";
else
if (a[0]=='P' and a[3]!='P' and a[6]=='P' and a[9]!='P') cout << p - 2<<" ";
else
if (a[0]=='P' and a[3]!='P' and a[6]!='P' and a[9]!='P') cout << p - 1<<" ";
else
if (a[0]!='P' and a[3]=='P' and a[6]!='P' and a[9]!='P') cout << p - 1<<" ";
else
if (a[0]!='P' and a[3]!='P' and a[6]=='P' and a[9]!='P') cout << p - 1<<" ";
else
if (a[0]!='P' and a[3]!='P' and a[6]!='P' and a[9]=='P') cout << p - 1<<" ";
else
if (a[0]!='P' and a[3]!='P' and a[6]!='P' and a[9]!='P') cout << p<<" ";
if (a[0]=='K' and a[3]=='K' and a[6]=='K' and a[9]=='K') cout << k - 4<<" ";
else
if (a[0]=='K' and a[3]=='K' and a[6]=='K' and a[9]!='K') cout << k - 3<<" ";
else
if (a[0]=='K' and a[3]=='K' and a[6]!='K' and a[9]=='K') cout << k - 3<<" ";
else
if (a[0]=='K' and a[3]!='K' and a[6]=='K' and a[9]=='K') cout << k - 3<<" ";
else
if (a[0]!='K' and a[3]=='K' and a[6]=='K' and a[9]=='K') cout << k - 3<<" ";
else
if (a[0]=='K' and a[3]=='K' and a[6]!='K' and a[9]!='K') cout << k - 2<<" ";
else
if (a[0]=='K' and a[3]!='K' and a[6]!='K' and a[9]=='K') cout << k - 2<<" ";
else
if (a[0]!='K' and a[3]!='K' and a[6]=='K' and a[9]=='K') cout << k - 2<<" ";
else
if (a[0]!='K' and a[3]=='K' and a[6]=='K' and a[9]!='K') cout << k - 2<<" ";
else
if (a[0]!='K' and a[3]=='K' and a[6]!='K' and a[9]=='K') cout << k - 2<<" ";
else
if (a[0]=='K' and a[3]!='K' and a[6]=='K' and a[9]!='K') cout << k - 2<<" ";
else
if (a[0]=='K' and a[3]!='K' and a[6]!='K' and a[9]!='K') cout << k - 1<<" ";
else
if (a[0]!='K' and a[3]=='K' and a[6]!='K' and a[9]!='K') cout << k - 1<<" ";
else
if (a[0]!='K' and a[3]!='K' and a[6]=='K' and a[9]!='K') cout << k - 1<<" ";
else
if (a[0]!='K' and a[3]!='K' and a[6]!='K' and a[9]=='K') cout << k - 1<<" ";
else
if (a[0]!='K' and a[3]!='K' and a[6]!='K' and a[9]!='K') cout << k<<" ";
if (a[0]=='H' and a[3]=='H' and a[6]=='H' and a[9]=='H') cout << h - 4<<" ";
else
if (a[0]=='H' and a[3]=='H' and a[6]=='H' and a[9]!='H') cout << h - 3<<" ";
else
if (a[0]=='H' and a[3]=='H' and a[6]!='H' and a[9]=='H') cout << h - 3<<" ";
else
if (a[0]=='H' and a[3]!='H' and a[6]=='H' and a[9]=='H') cout << h - 3<<" ";
else
if (a[0]!='H' and a[3]=='H' and a[6]=='H' and a[9]=='H') cout << h - 3<<" ";
else
if (a[0]=='H' and a[3]=='H' and a[6]!='H' and a[9]!='H') cout << h - 2<<" ";
else
if (a[0]=='H' and a[3]!='H' and a[6]!='H' and a[9]=='H') cout << h - 2<<" ";
else
if (a[0]!='H' and a[3]!='H' and a[6]=='H' and a[9]=='H') cout << h - 2<<" ";
else
if (a[0]!='H' and a[3]=='H' and a[6]=='H' and a[9]!='H') cout << h - 2<<" ";
else
if (a[0]!='H' and a[3]=='H' and a[6]!='H' and a[9]=='H') cout << h - 2<<" ";
else
if (a[0]=='H' and a[3]!='H' and a[6]=='H' and a[9]!='H') cout << h - 2<<" ";
else
if (a[0]=='H' and a[3]!='H' and a[6]!='H' and a[9]!='H') cout << h - 1<<" ";
else
if (a[0]!='H' and a[3]=='H' and a[6]!='H' and a[9]!='H') cout << h - 1<<" ";
else
if (a[0]!='H' and a[3]!='H' and a[6]=='H' and a[9]!='H') cout << h - 1<<" ";
else
if (a[0]!='H' and a[3]!='H' and a[6]!='H' and a[9]=='H') cout << h - 1<<" ";
else
if (a[0]!='H' and a[3]!='H' and a[6]!='H' and a[9]!='H') cout << h <<" ";
if (a[0]=='T' and a[3]=='T' and a[6]=='T' and a[9]=='T') cout << t - 4<<" ";
else
if (a[0]=='T' and a[3]=='T' and a[6]=='T' and a[9]!='T') cout << t - 3<<" ";
else
if (a[0]=='T' and a[3]=='T' and a[6]!='T' and a[9]=='T') cout << t - 3<<" ";
else
if (a[0]=='T' and a[3]!='T' and a[6]=='T' and a[9]=='T') cout << t - 3<<" ";
else
if (a[0]!='T' and a[3]=='T' and a[6]=='T' and a[9]=='T') cout << t - 3<<" ";
else
if (a[0]=='T' and a[3]=='T' and a[6]!='T' and a[9]!='T') cout << t - 2<<" ";
else
if (a[0]=='T' and a[3]!='T' and a[6]!='T' and a[9]=='T') cout << t - 2<<" ";
else
if (a[0]!='T' and a[3]!='T' and a[6]=='T' and a[9]=='T') cout << t - 2<<" ";
else
if (a[0]!='T' and a[3]=='T' and a[6]=='T' and a[9]!='T') cout << t - 2<<" ";
else
if (a[0]!='T' and a[3]=='T' and a[6]!='T' and a[9]=='T') cout << t - 2<<" ";
else
if (a[0]=='T' and a[3]!='T' and a[6]=='T' and a[9]!='T') cout << t - 2<<" ";
else
if (a[0]=='T' and a[3]!='T' and a[6]!='T' and a[9]!='T') cout << t - 1<<" ";
else
if (a[0]!='T' and a[3]=='T' and a[6]!='T' and a[9]!='T') cout << t - 1<<" ";
else
if (a[0]!='T' and a[3]!='T' and a[6]=='T' and a[9]!='T') cout << t - 1<<" ";
else
if (a[0]!='T' and a[3]!='T' and a[6]!='T' and a[9]=='T') cout << t - 1<<" ";
else
if (a[0]!='T' and a[3]!='T' and a[6]!='T' and a[9]!='T') cout << t;
return 0;
}