main :: IO()
main = do
    str <- getLine
    putStrLn $ if (getsolve str) then "Yes" else "No"
    
    
getsolve :: String -> Bool
getsolve str
    | comp12 && comp34 && not comp23
    | comp13 && comp24 && not comp12
    | comp14 && comp23 && not comp12
    where comp12 = str!!0 == str!!1
          comp13 = str!!0 == str!!2
          comp14 = str!!0 == str!!3
          comp23 = str!!1 == str!!2
          comp24 = str!!1 == str!!3
          comp34 = str!!2 == str!!3
