--- Writeup at https://work.njae.me.uk/2021/12/13/advent-of-code-2021-day-13/
+-- Writeup at https://work.njae.me.uk/2021/12/16/advent-of-code-2021-day-14/
import Data.Text ()
import qualified Data.Text.IO as TIO
where a = pair!!1
c = rules ! pair
--- countElements :: PolyPairs -> MS.MultiSet Char
countElements :: PolyPairs -> M.Map Char Int
countElements pairs = counts
where firsts = MS.map (!!0) pairs
seconds = MS.map (!!1) pairs
elems = S.union (MS.toSet firsts) (MS.toSet seconds)
- -- counts = MS.fromMap $ M.map ((`div` 2) . (+ 1)) $ MS.toMap $ MS.union firsts seconds
counts = M.map ((`div` 2) . (+ 1)) $ MS.toMap $ MS.union firsts seconds