"use strict"

const main = (input) => {
    input = input.split("");
    const S = new Set(input);
    if (S.size == 2) {
        console.log("Yes");
    } else {
        console.log("No");
    }
};

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