open System.IO let lines = File.ReadLines "day6.txt" |> Seq.toArray |> Array.map (fun x -> x.ToCharArray()) |> array2D let rows, cols = Array2D.length1 lines, Array2D.length2 lines let chars (reversed:bool) = seq { for i = 0 to cols - 1 do let col = lines[*, i] yield col |> Seq.countBy id |> Seq.sortBy (snd) |> if reversed then Seq.last else Seq.head |> fst |> string } // part 1 chars true |> String.concat "" |> printfn "%s" // part 2 chars false |> String.concat "" |> printfn "%s"