let fifty s =
  if s.[0] = s.[1] && s.[2] = s.[3] && s.[0] <> s.[2] then "Yes"
  else if s.[0] = s.[2] && s.[1] = s.[3] && s.[0] <> s.[1] then "Yes"
  else if s.[0] = s.[3] && s.[1] = s.[2] && s.[0] <> s.[1] then "Yes"
  else "No"

let () = Printf.printf "%s\n" (fifty (read_line ()))
