import std.stdio, std.math, std.algorithm, std.array, std.string, std.conv, std.container, std.range;
T[] Reads(T)() { return readln.split.to!(T[]); }
alias reads = Reads!(int);

void scan(Args...)(ref Args args) {
    import std.conv : parse;
    string[] ss = readln.split;
    int i;
    foreach (ref arg ; args)
        arg = ss[i++].parse!int;
}

bool f(string s) {
    int[] cnt = new int[26];
    foreach(c;s) cnt[c - 'A']++;
    return cnt.count(2) == 2;
}

void main() {
    string s = readln.chomp;
    writeln(f(s) ? "Yes" : "No");
}
