Scanf.scanf "%s" (fun ss ->
    let nn = String.length ss in
    let rec loop i n w s e =
        if i = nn then ((n = 0) = (s = 0) && (w = 0) = (e = 0)) else
            match ss.[i] with
            | 'N' -> loop (i + 1) (n + 1) w s e
            | 'W' -> loop (i + 1) n (w + 1) s e
            | 'S' -> loop (i + 1) n w (s + 1) e
            | 'E' -> loop (i + 1) n w s (e + 1)
            | _ -> failwith "??"
    in
    print_endline @@ if loop 0 0 0 0 0 then "Yes" else "No"
)