Q, Haskell.
I need to define function encode and decode. Details about the
functions are provided in code.
-- | encode
--
-- Given a string, return a list of encoded values of type (Int,Char)
--
-- >>> encode ['a','a','a','a','b','c','c','a','a','d','e','e','e','e']
-- [(4,'a'),(1,'b'),(2,'c'),(2,'a'),(1,'d'),(4,'e')]
--
-- >>> encode "hello"
-- [(1,'h'),(1,'e'),(2,'l'),(1,'o')]
--
-- >>> encode []
-- []
--
encode :: String -> [(Int,Char)]
encode = undefined
-- | decode
--
-- Given a list of encoded values of type (Int,Char), generate...