package main import ( "bufio" "fmt" "os" "strconv" ) func nextInt(sc *bufio.Scanner) int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func isThreeNumber(num int) bool { if num%3 == 0 { return true } for j := num; j > 0; j /= 10 { if j%10 == 3 { return true } } return false } func main() { sc := bufio.NewScanner(os.Stdin) sc.Split(bufio.ScanWords) a := nextInt(sc) b := nextInt(sc) for i := a; i <= b; i++ { if isThreeNumber(i) { fmt.Println(i) } } }