import java.util.Scanner;
class Main {
	public static void main(String[] args) {
		Scanner reader=new Scanner(System.in);
		int a=0,b=0,c=0,d=0;
		String str=reader.nextLine();
		char[] ch=str.toCharArray();
		for(int i=0;i<ch.length;i++){
			if(ch[i]>='A'&&ch[i]<='Z'){
				a=a+1;
			}
			else if(ch[i]>='a'&&ch[i]<='z'){
				b=b+1;
			}
			else if(ch[i]>='0'&&ch[i]<='9'){
				c=c+1;
			}
			else if(ch[i]==' '){
				d=d+1;
			}
		}
		System.out.println(a+" "+b+" "+c+" "+d);
	}

}

/**************************************************************
	Problem: 2224
	User: admin
	Language: Java
	Result: Accepted
	Time:5714 ms
	Memory:43792 kb
****************************************************************/