let () = Scanf.scanf "%s" @@ fun s ->
  let ary = Array.init (String.length s) @@
    fun i -> String.get s i in
  let () = Array.sort compare ary in
  let ans = if ary.(0) = ary.(1) && ary.(1) <> ary.(2) && ary.(2) = ary.(3) then "Yes" else "No" in
  Printf.printf "%s\n" ans