import Data.List
main :: IO ()
main = do
    s <- getLine
    putStrLn $ if count head s == 2 && count last s == 2 then "Yes" else "No"
        where grouping = group . sort
              count = \f s -> length $ f (grouping s)