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