S = list(input()) tmp = [] A = '1010' B = '1011' C = '1100' D = '1101' E = '1110' F = '1111' for s in S: if s == 'A': tmp.append(A) elif s == 'B': tmp.append(B) elif s == 'C': tmp.append(C) elif s == 'D': tmp.append(D) elif s == 'E': tmp.append(E) elif s == 'F': tmp.append(F) tmp = ''.join(tmp) if len(tmp)%3 == 1: tmp = '00' + tmp elif len(tmp)%3 == 2: tmp = '0' + tmp vec = [tmp[i: i+3] for i in range(0, len(tmp), 3)] # print(tmp) # print(vec) ans = [] for v in vec: if v == '000': ans.append('0') elif v == '001': ans.append('1') elif v == '010': ans.append('2') elif v == '011': ans.append('3') elif v == '100': ans.append('4') elif v == '101': ans.append('5') elif v == '110': ans.append('6') elif v == '111': ans.append('7') ans = str(int(''.join(ans))) # print(ans) from collections import defaultdict d = defaultdict(int) for a in ans: d[a] += 1 # print(d) max_k_list = [kv[0] for kv in d.items() if kv[1] == max(d.values())] print((' '.join(sorted(max_k_list))))