30 lines
447 B
Go
30 lines
447 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"internal/day07"
|
|
"internal/util"
|
|
)
|
|
|
|
func main() {
|
|
data := util.ReadInput()
|
|
|
|
// Build a tree of dependencies.
|
|
root := day07.BuildDependencyTree(data)
|
|
|
|
// Walk the tree and determine the correct ordering.
|
|
order := day07.FindOrder(root)
|
|
|
|
output := strings.Builder{}
|
|
for _, node := range order {
|
|
if node.Name == 0 {
|
|
continue
|
|
}
|
|
|
|
output.WriteRune(node.Name)
|
|
}
|
|
fmt.Println(output.String())
|
|
}
|