Codeforces 146A - A. Lucky Ticket
import Data.Char isLucky :: String -> Bool isLucky s = all (\c -> c == '4' || c == '7') s calc :: String -> String calc s = if isLucky s && sum hd == sum tl then "YES" else "NO" where xs = map digitToInt s n = length s `div` 2 hd = take n xs tl = drop n xs main = do s <- getLine t <- getLine putStrLn $ calc t