defmodule AOC.Day6 do def part1 do AOC.Util.input_file(6, 1) |> String.split("\n\n") |> Enum.map(fn group -> group |> String.replace("\n", "") |> String.to_charlist() |> Enum.uniq() |> Enum.count() end) |> Enum.sum() end def part2 do AOC.Util.input_file(6, 1) |> String.split("\n\n") |> Enum.map(fn group -> count = String.split(group, "\n") |> Enum.count() group |> String.replace("\n", "") |> String.to_charlist() |> Enum.frequencies() |> Enum.count(fn {_, v} -> v == count end) end) |> Enum.sum() end end