git.haldean.org aoc-2018 / 41b5814
even prettier! Haldean Brown 1 year, 10 days ago
1 changed file(s) with 3 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
11 import Data.Char
22 import Data.Function
33
4 collapse1 (a:b:ss) = if toLower a == toLower b && a /= b then collapse1 ss else a:(collapse1 $ b:ss)
4 collapse1 (a:b:ss)
5 | toLower a == toLower b && a /= b = collapse1 ss
6 | otherwise = a:(collapse1 $ b:ss)
57 collapse1 s = s
68 collapse s = let cs = collapse1 s in if cs == s then s else collapse cs
79 main = readFile "input.txt" >>= (collapse >>> length >>> subtract 1 >>> print)