USING: grouping io.encodings.utf8 io.files kernel math math.ranges sequences sets ; IN: aoc.3 : input ( -- i ) "~/factor/aoc/3/3.in" utf8 file-lines ; : priorities ( -- p ) 97 122 [a,b] 65 90 [a,b] append ; : intersection-score ( seq -- n ) intersection first priorities index 1 + ; : part1 ( -- n ) input [ halves { } 2sequence intersection-score ] map-sum ; : part2 ( -- n ) input 3 [ intersection-score ] map-sum ;