import std.algorithm;
import std.array;
import std.bigint;
import std.bitmanip;
import std.conv;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T diff(T)(const ref T a, const ref T b) { return a > b ? a - b : b - a; }

T[] readToArray(T)() {
    return readln.split.to!(T[]);
}

void readInto(T...)(ref T ts) {
    auto ss = readln.split;
    foreach(ref t; ts) {
        t = ss.front.to!(typeof(t));
        ss.popFront;
    }
}

void main() {
    int[char] a;
    const string s = readln.chomp;
    foreach(c; s) {
        a[c]++;
    }

    if (a.length == 2 && a[s[0]] == 2) {
        writeln("Yes");
    } else {
        writeln("No");
    }
}
