import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { static int[] counts = new int[]{ 20104, 20063, 19892, 20011, 19874, 20199, 19898, 20163, 19956, 19841 }; public static int[] process(char[] inputs, boolean output){ int[] arr = new int[10]; for(final char ch : inputs){ if(!Character.isDigit(ch)){ continue; } arr[Character.getNumericValue(ch)]++; } if(!output){ return arr; } for(final int a : arr){ System.out.println(a + ","); } return arr; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); char[] input = sc.next().toCharArray(); boolean debug = false; int[] arr = process(input, debug); int less = -1, more = -1; for(int i = 0; i < 10; i++){ if(counts[i] < arr[i]){ more = i; }else if(counts[i] > arr[i]){ less = i; } } System.out.println(more + " " + less); } public static class Scanner { private BufferedReader br; private StringTokenizer tok; public Scanner(InputStream is) { br = new BufferedReader(new InputStreamReader(is)); } private void getLine() { try { while (!hasNext()) {tok = new StringTokenizer(br.readLine());} } catch(IOException e){ /* ignore */ } } private boolean hasNext() { return tok != null && tok.hasMoreTokens(); } public String next() { getLine(); return tok.nextToken(); } public int nextInt(){ return Integer.parseInt(next()); } public void close() { try{ br.close(); } catch (IOException e){ /*ignore*/ } } } }