7 mapset "github.com/deckarep/golang-set/v2"
11 func Part1(input string) int {
13 lines := strings.Split(input, "\n")
14 for _, line := range lines {
15 c1 := []rune(line[:len(line)/2])
16 c1set := mapset.NewSet[rune](c1...)
18 c2 := []rune(line[len(line)/2:])
19 c2set := mapset.NewSet[rune](c2...)
20 for _, v := range c1set.Intersect(c2set).ToSlice() {
27 func getValue(v rune) int {
28 if v >= 'a' && v <= 'z' {
29 return int(v) - int('a') + 1
31 if v >= 'A' && v <= 'Z' {
32 return int(v) - int('A') + 27
37 func Part2(input string) int {
40 lines := strings.Split(input, "\n")
41 for idx=0; idx < len(lines); idx += 3 {
42 c1 := []rune(lines[idx])
43 c1set := mapset.NewSet[rune](c1...)
44 c2 := []rune(lines[idx+1])
45 c2set := mapset.NewSet[rune](c2...)
46 c3 := []rune(lines[idx+2])
47 c3set := mapset.NewSet[rune](c3...)
48 for _, v := range c1set.Intersect(c2set).Intersect(c3set).ToSlice() {