import Data.List
import Data.Bool

main :: IO()
main = do
  s <- getLine
  putStrLn $ solve s

solve :: String -> String
solve s =
  bool "No" "Yes" $
    and [a == b, b /= c, c == d]
  where
    [a, b, c, d] = sort s