import Control.Applicative
import Data.List

main :: IO ()
main = solve <$> getLine >>= putStrLn

solve :: String -> String
solve s
  | a == b && b /= c && c == d = "Yes"
  | otherwise = "No"
  where
    [a, b, c, d] = sort s
