Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module Main where
  2.  
  3. data Hello = NULL
  4.            | H
  5.            | E
  6.            | L1
  7.            | L2
  8.  
  9. sample = "ahhellllloou"
  10.  
  11. yoba [] = False
  12. yoba xs = yoba' NULL xs
  13.  
  14. yoba' _ [] = False
  15. yoba' NULL (x:xs) | x == 'h'  = yoba' H xs
  16.                   | otherwise = yoba' NULL xs
  17. yoba' H (x:xs) | x == 'e'  = yoba' E xs
  18.               | otherwise = yoba' H xs
  19. yoba' E (x:xs) | x == 'l'  = yoba' L1 xs
  20.                | otherwise = yoba' E xs
  21. yoba' L1 (x:xs) | x == 'l'  = yoba' L2 xs
  22.                | otherwise = yoba' L1 xs
  23. yoba' L2 (x:xs) | x == 'o' = True
  24.                | otherwise = yoba' L2 xs
  25.  
  26. main :: IO ()
  27. main = do str <- getLine
  28.           if (yoba str)
  29.             then putStrLn "YES"
  30.             else putStrLn "NO"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement