import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String s = sc.next(); String bin = ""; int[] cnt = new int[8]; for( int i = 0; i < s.length(); i++ ) { String ch = s.substring(i,i+1); int d = Integer.parseInt(ch,16); String ad = Integer.toString(d,2); bin += ad; } for( int i = bin.length(); i > 0; i-=3 ){ String row = bin.substring(Math.max(0,i-3),i); int k = Integer.parseInt(row,2); cnt[k]++; } int max = 0; for( int i = 0; i < 8; i++ ) { max = Math.max(max,cnt[i]); } for( int i = 0; i < 8; i++ ) { if( cnt[i] == max ) { System.out.print(i+" "); } } System.out.println(); } }