16 lines
295 B
Haskell
16 lines
295 B
Haskell
|
import Data.Char
|
||
|
|
||
|
digits :: String -> String
|
||
|
digits = filter isDigit
|
||
|
|
||
|
calibrationValue :: String -> Int
|
||
|
calibrationValue x = read [ head $ digits x, last $ digits x ]
|
||
|
|
||
|
main = do
|
||
|
inputs <- readFile "inputs/1.0"
|
||
|
let lns = lines inputs
|
||
|
let res = sum $ map calibrationValue lns
|
||
|
print res
|
||
|
|
||
|
|