r=raw_input;s=r();n=9 while n: n+=1;x="%x"%n if(set(x)(x in s):s=r(x+'\n');n=9