|  | 
|  | 
| back to board | For Haskell programmers: '\r' character in input Posted by b108  8 Jan 2014 21:53I have WA#1 but algo was right.I use this construction:
 
 import qualified Data.ByteString.Char8 as C8
 
 ...
 
 input <- C8.getLine
 
 C8.putStr $ result input
 
 
 ----------
 
 But I have always WA#1. At my PC (Linux) I have right answers.
 
 then i tried:
 
 
 input' <- C8.getLine
 
 let
 input = if (C8.index input' (-1 + C8.length input')) == '\r' then C8.init input' else input'
 
 --------
 
 So, i removed last character '\r' from line if it exists. And after this my code was accepted!
 | 
 | 
|