import Prelude hiding(head,tail) tail [] = error"empty" tail (a:b) = b; head [] = [] head (a:b) = a check1 :: [Char] -> [Char] -> Int -> Bool check1 [] (a:b) _ = False check1 _ [] s = if s == 3 then True else False check1 (h@(a1:b1)) (a2:b2) s = if a1 == a2 then check1 b1 b2 (s+1) --後が575 else if s == 0 then check1 b1 "575" 0 else check1 h "575" 0 main = do string <- getLine if check1 string "575" 0 == True then putStrLn("YES") else putStrLn("NO")