import Control.Applicative
import Control.Monad
 
main :: IO ()
main = do
    x:xs <- getLine
    putStrLn $ solve (filter (/= x) xs)

solve :: String -> String 
solve xs = if length xs == 2 then 
              if head xs == last xs then "Yes"
              else "No"
           else "No"