
import Data.Char (ord) import Data.List (sort) score word = sum $ map (\char -> ord char - ord 'A' + 1) word nameScore filename = do content <- readFile filename let names = read $ "[" ++ content ++ "]" return $ sum $ zipWith (*) [1..] $ map score $ sort names
λ> nameScore "names.txt" 871198282 λ>
— Me@2024-09-09 03:40:11 PM
.
.
2024.09.10 Tuesday (c) All rights reserved by ACHK

You must be logged in to post a comment.