summaryrefslogtreecommitdiff
path: root/2015/day10.hs
blob: e5ff55409dee7b773f52beda695bd1766a682273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Main where

import Data.Char
import Data.List
import Control.Monad

looksay :: String -> String
looksay "" = ""
looksay s = chr (48 + length start) : head s : looksay rest
    where start = takeWhile (== head s) s
          rest = drop (length start) s

day9 :: IO ()
day9 = do
    let input = "1113122113"
    print $ length $ (iterate looksay input) !! 50

main = day9