import Data.List

main :: IO ()
main = do
    s <- getLine
    putStrLn $ if solve s then "Yes" else "No"

solve s =
    x && y
    where
        ss = map length . group . sort $ s
        x = length ss == 2
        y = all (==2) ss