open Printf
open Scanf

let solve s =
  let l = List.sort compare @@ List.map (fun i -> String.get s i) [0;1;2;3] in
  match l with
    a::b::c::d::_ when a = b && c = d && b <> c -> "Yes"
  | _ -> "No"

let () =
  scanf "%s " solve |> printf "%s\n"
