let s = Array.to_list @@ Array.init 4 @@ fun _ -> Scanf.scanf " %c" @@ fun c -> c
let s' = List.sort_uniq compare s |> Array.of_list
let c = Array.length s'
let list_count f ls =
  let rec list_count_kernel count = function
  | [] -> count
  | x :: xs -> list_count_kernel (if f x then count + 1 else count) xs
  in
    list_count_kernel 0 ls
let _ = print_endline @@
  if c <> 2 then "No"
  else
    if list_count ((=) s'.(0)) s = 2 && list_count ((=) s'.(1)) s = 2 then "Yes" else "No"