use std::io; fn is_ok(mut n: u32) -> bool { if n % 3 == 0 { return true; } while n > 0 { if n % 10 == 3 { return true; } n /= 10; } false } fn main() { let mut ab = String::new(); io::stdin().read_line(&mut ab).unwrap(); let ab: Vec = ab.trim().split(' ').map(|s| s.parse().unwrap()).collect(); for i in (ab[0]..ab[1] + 1).filter(|&n| is_ok(n)) { println!("{}", i); } }