Search code examples
haskelliostdoutdouble-quotes

Suppress quotes in stdout (hackerrank)


I'm working on a string compression problem in Hackerrank in Haskell, and stuck on the IO. I am trying to be explicit about removing quotes.

compress :: [Char] -> [Char]
compress = ...

main :: IO ()
main = do
    input <- getLine
    let result = compress input
    print $ filter (/='"') result 

The code compiles and returns the correct response, albeit surrounded in quotes.

Compiler Message
Wrong Answer

Input (stdin)
abcaaabbb

Your Output (stdout)
"abca3b3"

Expected Output
abca3b3

Solution

  • You write:

    putStrLn result
    

    instead of last line:

     print $ filter (/='"') result