adventofcode/2018/day05-2.go

28 lines
424 B
Go
Raw Normal View History

2018-12-05 09:04:53 +00:00
package main
import (
"fmt"
"internal/polymer"
"internal/util"
)
func main() {
data := util.ReadInputBytes()
result := [26][]byte{}
for i := 0; i < 26; i++ {
result[i] = polymer.StripElement(data, rune('a'+i))
result[i] = polymer.ApplyReactions(result[i])
}
shortest := len(result[0])
for i := 1; i < 26; i++ {
if len(result[i]) < shortest {
shortest = len(result[i])
}
}
fmt.Println(shortest)
}