#include<bits/stdc++.h> #define S strchr int b=0,g=0; char B[]="boy",G[]="girl",c,s='.',*t; int main(){ while(~(c=getchar())){ if(c!=46){ (t=S(B,c)?S(B,c):S(G,c))--; if(s==46||*t!=s) (S(B,c)?b:g)++; } s=c; } printf("%d\n%d",b,g); return 0; }