import sys from collections import defaultdict def debug(*args): print(*args, file=sys.stderr) s = input() t = input() dd = defaultdict(int) for i in range(2): for j in range(2): x = set() x.add(s[i]) x.add(t[j]) if 'A' in x and 'B' not in x: dd['A'] += 1 elif 'A' not in x and 'B' in x: dd['B'] += 1 elif 'A' in x and 'B' in x: dd['AB'] += 1 else: dd['O'] += 1 ans = [] ans.append(dd['A']*25) ans.append(dd['B']*25) ans.append(dd['AB']*25) ans.append(dd['O']*25) print(*ans)