function main(input) {
    var list = input.split("");
    var data = {};
    for (var i = 0; i < list.length; i++){
        var key = list[i];
        if (data[key] == undefined) data[key] = 0;
        data[key]++;
    }
    if (Object.keys(data).length == 2 && data[Object.keys(data)[0]] == 2) {
        console.log("Yes");
    } else {
        console.log("No");
    }
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
