while 1: a='a'+raw_input() i=1 exec'i+=a[i-1]<=a[i];'*99 print a[i-(a[i]>=a[i-2])]