GPJ3G6KRNB4WFU7YSG2744TKZP3FP4F4OIP7HF6HX2JXANMRKOCAC
3Z2JGC4OE7C3N2ZON2F7AO4FLVARI3J2BV4CNAKXD7B7QE6CYP4AC
type Container struct { root string childs []Contains}
type Container struct {
root string
childs []Contains
}
type Container map[string][]Contains
// log.Printf("%d bags could be tucked in a %q", solveSecond(data), myBag)
func solveFirst(data []Container) int {
func solveFirst(data Container) int {
for _, d := range data { for _, c := range d.childs {
for _, d := range data {
for _, c := range d.childs {
for d := range data { for _, c := range data[d] {
for d := range data {
for _, c := range data[d] {
direct = append(direct, d.root)
direct = append(direct, d)
indirect[d.root] = true
indirect[d] = true
func parseInput() ([]Container, error) {
func parseInput() (Container, error) {
ret := []Container{}
ret := Container{}
bag := Container{} bag.root = reContainer.FindString(buf.Text())
bag := Container{}
bag.root = reContainer.FindString(buf.Text())
root := reContainer.FindString(buf.Text()) ret[root] = []Contains{}
root := reContainer.FindString(buf.Text())
ret[root] = []Contains{}
bag.childs = append(bag.childs, c)
ret[root] = append(ret[root], c)
ret = append(ret, bag)