Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module Main where
- data Hello = NULL
- | H
- | E
- | L1
- | L2
- sample = "ahhellllloou"
- yoba [] = False
- yoba xs = yoba' NULL xs
- yoba' _ [] = False
- yoba' NULL (x:xs) | x == 'h' = yoba' H xs
- | otherwise = yoba' NULL xs
- yoba' H (x:xs) | x == 'e' = yoba' E xs
- | otherwise = yoba' H xs
- yoba' E (x:xs) | x == 'l' = yoba' L1 xs
- | otherwise = yoba' E xs
- yoba' L1 (x:xs) | x == 'l' = yoba' L2 xs
- | otherwise = yoba' L1 xs
- yoba' L2 (x:xs) | x == 'o' = True
- | otherwise = yoba' L2 xs
- main :: IO ()
- main = do str <- getLine
- if (yoba str)
- then putStrLn "YES"
- else putStrLn "NO"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement