import java.util.Scanner object Problem207 { def nantoka(i: Int): Boolean = i % 3 == 0 || i.toString.contains('3') def main(args: Array[String]) { val sc = new Scanner(System.in) val A = sc.nextInt() val B = sc.nextInt() for (i <- A to B) { if (nantoka(i)) { println(i) } } } }