n=input() n="0x" + n s=int(n,16) #10進数 s=oct(s) m=len(s) l=[] for i in range(2,m): l.append(str(s[i])) l3=[] l2=list(set(l)) q=[] for i in l2: l3.append([int(i),l.count(i)]) q.append(l.count(i)) from operator import itemgetter l3.sort(key=itemgetter(1)) l3.reverse() ans=[] for x in l3: if x[1]==max(q): ans.append(x[0]) print(*ans)