def atoi(a): return ord("A") - ord(a) + 10 ans = 0 h = 1 n = input() for a in n[::-1]: ans += h * atoi(a) h *= 16 cnt = [0] * 10 while ans > 0: ans, v = divmod(ans, 10) cnt[v] += 1 answer = [] v = max(cnt) for i in range(10): if cnt[i] == v: answer.append(i) print(*ans)