【发布时间】:2019-12-27 10:28:39
【问题描述】:
我正在 Haskell 的 Hackerrank 中处理 string compression problem,并坚持使用 IO。我试图明确删除引号。
compress :: [Char] -> [Char]
compress = ...
main :: IO ()
main = do
input <- getLine
let result = compress input
print $ filter (/='"') result
代码编译并返回正确的响应,尽管用引号括起来。
Compiler Message
Wrong Answer
Input (stdin)
abcaaabbb
Your Output (stdout)
"abca3b3"
Expected Output
abca3b3
【问题讨论】:
-
引号不在字符串的 content 中。这些在字符串的表示中,因为
print调用show。
标签: haskell io stdout double-quotes