抑制标准输出中的引号 (hackerrank)
Suppress quotes in stdout (hackerrank)
我正在 Haskell 的 Hackerrank 中进行 string compression problem 的研究,并停留在 IO 上。我试图明确删除引号。
compress :: [Char] -> [Char]
compress = ...
main :: IO ()
main = do
input <- getLine
let result = compress input
print $ filter (/='"') result
代码编译并 returns 正确的响应,尽管用引号引起来。
Compiler Message
Wrong Answer
Input (stdin)
abcaaabbb
Your Output (stdout)
"abca3b3"
Expected Output
abca3b3
你写:
putStrLn result
而不是最后一行:
print $ filter (/='"') result
我正在 Haskell 的 Hackerrank 中进行 string compression problem 的研究,并停留在 IO 上。我试图明确删除引号。
compress :: [Char] -> [Char]
compress = ...
main :: IO ()
main = do
input <- getLine
let result = compress input
print $ filter (/='"') result
代码编译并 returns 正确的响应,尽管用引号引起来。
Compiler Message
Wrong Answer
Input (stdin)
abcaaabbb
Your Output (stdout)
"abca3b3"
Expected Output
abca3b3
你写:
putStrLn result
而不是最后一行:
print $ filter (/='"') result