s = input() b = [] for ss in s: b.append(bin(ord(ss)-ord('A')+10)[2:]) c = ''.join(b) if len(c)%3==1: c = '00'+c if len(c)%3==2: c = '0'+c c = [int(i) for i in c] cnt = [0]*8 for i in range(0,len(c),3): cnt[c[i]*4+c[i+1]*2+c[i+2]] += 1 mc = max(cnt) ans = [] for i in range(8): if cnt[i]==mc: ans.append(i) print(*ans)