package one import ( "bytes" "io" ) func parseLines(r io.Reader) (int, map[kindOfSchematic][]*schematic, error) { raw, _ := io.ReadAll(r) rawSchematics := bytes.Split(raw, []byte("\n\n")) schematics := map[kindOfSchematic][]*schematic{Lock: {}, Key: {}} for _, rawSchematic := range rawSchematics { s := newSchematic(bytes.Split(rawSchematic, []byte("\n"))) schematics[s.kind] = append(schematics[s.kind], s) } maxHeight := len(schematics[Lock][0].heights) return maxHeight, schematics, nil } func allInString(s string, r rune) bool { for _, c := range s { if c != r { return false } } return true }