import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); char[] s = sc.next().toCharArray(); sc.close(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < s.length; i++) { int a = Integer.parseInt(String.valueOf(s[i]), 16); sb.append(Integer.toOctalString(a)); } int[] cnt = new int[8]; for (int i = 0; i < sb.length(); i++) { cnt[sb.charAt(i) - '0']++; } int max = 0; for (int i = 0; i < cnt.length; i++) { max = Math.max(max, cnt[i]); } StringBuilder sb2 = new StringBuilder(); for (int i = 0; i < cnt.length; i++) { if (cnt[i] == max) { sb2.append(i).append(' '); } } sb2.deleteCharAt(sb2.length() - 1); System.out.println(sb2.toString()); } }