function Main(input) {
    var N = input[0].split('');
    var uniqueStringList = new Set(N);
    console.log(uniqueStringList.size === 2 ? 'Yes' : 'No');
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));