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