#include <stdio.h>
#include <string.h>

int main() {
    char A[1001]={'\0'};
    int i=0,english=0,kong=0,num=0,other=0;

    fgets(A,1000,stdin);

    for (i=0;i<strlen(A);i++) { 

        if(((A[i]>='a')&&(A[i]<='z'))||((A[i]>='A')&&(A[i]<='Z'))){     //是否字母
           english++;
        }
        else{
              if(A[i]=='!'-1){                                             //是否空格
               kong++;
              }
              else{
                   if((A[i]>='0')&&(A[i]<='9')){                          //是否数字
                   num++;
                   
                   }
                   else{               //事例为什么会给我多一???
                        other++;
                    }
             }
        }


    }

    printf("%d\n%d\n%d\n%d\n",english,kong,num,other-1);
    return 0;
}