package one import ( "bufio" "io" "maps" ) func parseLines(r io.Reader) (*graph, error) { graph := newGraph() scanner := bufio.NewScanner(r) for scanner.Scan() { graph.data = append(graph.data, scanner.Text()) } if err := scanner.Err(); err != nil { return nil, err } return graph, nil } func replaceAtIndex(s string, r rune, i int) string { out := []rune(s) out[i] = r return string(out) } func firstPointFromMap(visited map[point]struct{}) point { for k := range maps.Keys(visited) { return k } panic("unable to fetch points from map") }