from collections import Counter S = list(input()) T = list(input()) cnt = Counter() for s in S: for t in T: p = [s, t] if 'A' in p and 'B' not in p: cnt['A'] += 25 elif 'A' not in p and 'B' in p: cnt['B'] += 25 elif 'A' in p and 'B' in p: cnt['AB'] += 25 else: cnt['O'] += 25 print(cnt['A'], cnt['B'], cnt['AB'], cnt['O'])