package two import ( "bufio" "io" "strconv" "strings" ) func parseLines(r io.Reader) ([]int, error) { secrets := []int{} scanner := bufio.NewScanner(r) for scanner.Scan() { secrets = append(secrets, mustConv(strings.TrimSpace(scanner.Text()))) } if err := scanner.Err(); err != nil { return nil, err } return secrets, nil } func mustConv(s string) int { n, err := strconv.Atoi(s) if err != nil { panic(err) } return n } func lastDigit(n int) int { return n % 10 }