26 lines
380 B
Go
26 lines
380 B
Go
package common
|
|
|
|
import (
|
|
"bufio"
|
|
)
|
|
|
|
type Tree int
|
|
|
|
type Forest [][]Tree
|
|
|
|
|
|
func Parse(scanner bufio.Scanner) Forest {
|
|
forest := Forest{}
|
|
|
|
for scanner.Scan() {
|
|
line := scanner.Text()
|
|
forestRow := make([]Tree, len(line))
|
|
for i, character := range line {
|
|
forestRow[i] = Tree(character - '0')
|
|
}
|
|
forest = append(forest, forestRow)
|
|
}
|
|
|
|
return forest
|
|
}
|