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

int main() {
    char s[1001] = {};
    unsigned int length = 0,i;
    unsigned int c=0,space=0,num=0,other=0;

    scanf("%[^\n]*c", s);
    length = strlen(s);
    for (i=0; i<length; ++i) {
        if (s[i]>='0' && s[i]<='9') {
            num++;
        } else if (s[i] == ' ') {
            space++;
        } else if ((s[i]>='A'&&s[i]<='Z')||(s[i]>='a'&&s[i]<='z')) {
            c++;
        } else {
            other++;
        }
    }
    printf("%d\n%d\n%d\n%d",c,space,num,other);

    return 0;
}