module Exercise04 where {-WETT-} xmlLight :: String -> Bool f :: Int -> [String] -> String -> Bool g :: Char -> [String] -> String -> Bool xmlLight = f 0 [] f 0 s (c:cs) = c == '<' && f 1 ([] : s) cs || c `notElem` "<>" && f 0 s cs f 1 s ('/':cs) = f 3 s cs f q (a:s) (c:cs) | q < 4 && c `notElem` "< />" = f q ((a ++ [c]) : s) cs f 3 (a:b:s)(c:cs) | c `elem` " >" = a == b && g c s cs f _ s (c:cs) | c `elem` " >" = g c s cs f q s _ = q == 0 && null s g ' ' = f 4 g _ = f 0 {-TTEW-}