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