function main(input) {
    var args = input.trim();
    var result = {};
    for(var i = 0; args.length > i; i++) {
        result[args[i]] = result[args[i]] ? result[args[i]] + 1 : 1;
    }

    if (Object.keys(result).length !== 2) {
        return "No";
    }

    return result[Object.keys(result)[0]] === 2 ? "Yes" : "No";
}

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