import re while 1:print sorted(re.findall("9*8*7*6*5*4*3*2*1*0*",`input()`),cmp,len,1)[0]