from collections import Counter def main(): n = input() n = oct(int(n, 16))[2:] c = Counter(n) ans = sorted([k for k, v in c.items() if v == max(c.values())]) print(*ans) if __name__ == "__main__": main()