from sys import stdin from collections import Counter N = stdin.readline().rstrip() #cnt = [0] * 8 pool = [] def hex2oct(x): octnum = oct(int(x, base=16))[2:] for elem in octnum: pool.append(elem) #ielem = ord(elem) - 48 #cnt[ielem] += 1 for c in N: hex2oct(c) res = [] c = Counter(pool) d = c.most_common() print(d, len(d)) mat = d[0][1] for i in range(len(d)): if mat == d[i][1]: res.append(d[i][0]) else: break res.sort() print(*res, end=' ')