Problem:
Score : 100 points

Problem Statement

Iroha loves Haiku. Haiku is a short form of Japanese poetry. A Haiku consists of three phrases with 5, 7 and 5 syllables, in this order.

To create a Haiku, Iroha has come up with three different phrases. These phrases have A, B and C syllables, respectively. Determine whether she can construct a Haiku by using each of the phrases once, in some order.

Constraints

1≦A,B,C≦10

Input

The input is given from Standard Input in the following format:

A B C

Output

If it is possible to construct a Haiku by using each of the phrases once, print YES (case-sensitive). Otherwise, print NO.

Sample Input 1

5 5 7

Sample Output 1

YES

Using three phrases of length 5, 5 and 7, it is possible to construct a Haiku.

Sample Input 2

7 7 5

Sample Output 2

NO

Solution in OCaml (4.02.3) (judge verdict: Runtime Error)

let contains num num_list =
  let str = string_of_int num
  and chr_list = List.map (fun x -> (string_of_int x).[0]) num_list in
  List.fold_left (fun x y -> x || (String.contains str y)) false chr_list

let unfold f init =
  let rec unfold_inner f init ret =
    match f init with
      Some (a, b) -> unfold_inner f b (a::ret)
    | None        -> ret
  in
  unfold_inner f init []

let make_list from to_ step =
  let accum x =
    if x > to_ then None else Some (x, x + step)
  in
  List.rev @@ unfold accum from

let solve n proh =
  let cand = make_list n (10*n) 1 in
  List.fold_left (fun x y -> if contains x proh then y else x) n cand

let read_list_of_int () =
  let rec read_list_of_int_inner lst =
    try let ans = (Scanf.scanf "%d " (fun x->x)) in
        read_list_of_int_inner (ans::lst)
    with End_of_file ->
      List.rev lst
  in
  read_list_of_int_inner []

let () =
  let n, k = Scanf.scanf "%d %d\n" (fun x y -> x,y) in
  let list = read_list_of_int () in
  let ans = solve n list in
  Printf.printf "%d\n" ans
;;