#include
#include
int main()
{
char a[128];
gets(a);
int i=0;
int c1,c2,c3,c4;
c1=c2=c3=c4=0;
while(a[i++])
{
if(a[i]>='A'&& a[i]<='Z') c1++;
else if(a[i]>='a'&& a[i]<='z') c2++;
else if(a[i]==' ') c3++;
else c4++;
}
printf("%d %d %d %d\n",c1,c2,c3,c4);
return 0;
}