import java.util.Scanner; import java.util.HashMap; class Main{ public static void main(String[] args){ Scanner sc = new Scanner(System.in); char[] S = sc.next().toCharArray(); char[] T = sc.next().toCharArray(); int[] ans = new int[4]; HashMap map = new HashMap<>(){{ put("AA",0); put("AO",0); put("OA",0); put("BB",1); put("BO",1); put("OB",1); put("AB",2); put("BA",2); put("OO",3); }}; for(char s:S) for(char t:T) ans[map.get(s+""+t)] += 25; System.out.printf("%d %d %d %d\n",ans[0],ans[1],ans[2],ans[3]); } }