// inputに入力データ全体が入る
function Main(input) {
    var S = input;
    var targetStr = S[0]
    var targetStr2 = S[2]
    var count = (S.match(new RegExp(targetStr, "g" ))||[]).length;
    var count2 = (S.match(new RegExp(targetStr2, "g" ))||[]).length;
    if(count == 2 && count2 == 2){
        console.log("Yes")
    }else{
        console.log("No")
    }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));