import java.util.*; import java.io.*; public class Main{ static final Reader sc = new Reader(); static final PrintWriter out = new PrintWriter(System.out,false); public static void main(String[] args) throws Exception { String str = sc.next(); int[] counter = new int[10]; Arrays.fill(counter,-1); ArrayList list = new ArrayList(); for(int i=0;i=0;i--){ if(flag){ break; } if(counter[i]==-1 || counter[i]==0){ continue; } int x = list.get(0); if(x>=i){ int count = 1; while(true){ if(count>=i){ break; } x = list.get(count); if(x