fn main() { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let mut c = s.trim().chars().rev(); let mut a = [0; 8]; let mut b: u8 = 0; loop { if b < 4 { if let Some(c) = c.next() { b += (c as u8 - b'A' + 10) << (b << 1 | 1).ilog2() } } if b > 0 { a[(b & 7) as usize] += 1; b >>= 3; } else { break; } } let m = a.iter().max().unwrap(); println!( "{}", a.iter() .enumerate() .filter_map(|(i, &x)| { if x == *m { Some(i.to_string()) } else { None } }) .collect::>() .join(" ") ) }