s = oct(int(input(),16))[2:] pcnt = [s.count(c) for c in "01234567"] ans = [] for i in range(8): if pcnt[i] == max(pcnt): ans.append(str(i)) print(" ".join(ans))