solve day 6 part 1
This commit is contained in:
parent
2083f92e40
commit
7831e58928
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,27 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
d, _ := ioutil.ReadFile("input")
|
||||
s := string(d)
|
||||
groups := strings.Split(s,"\n\n")
|
||||
total := 0
|
||||
for _, g := range groups {
|
||||
results := make(map[rune]bool)
|
||||
lines := strings.Split(g,"\n")
|
||||
for _, l := range lines {
|
||||
for _, c := range l {
|
||||
if _, ok := results[c]; !ok { // if it's not already accounted for
|
||||
results[c] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
total += len(results)
|
||||
}
|
||||
fmt.Println(total)
|
||||
}
|
Loading…
Reference in New Issue