import std.stdio;
import std.array;
import std.algorithm;
import std.string;
import std.container;
import std.typecons;

int size(in string s) {
    return cast(int)s.length;
}

void main() {
    string s = readln.chomp;

    immutable X = "ABC";
    bool check(in string s) {
        foreach (i, c; s) {
            if (s[i] != X[i]) return false;
        }
        return true;
    }

    bool f(in string s) {
        if (s.size < 3) return false;
        if (s.size == 3) {
            return check(s);
        }
        if (s.find("ABC").empty) return false;
        bool r = false;
        foreach (c; "ABC") {
            string t = "" ~ c;
            if (!s.replace("ABC", "").find(t).empty) continue;
            r |= f(s.replace("ABC", t));
        }
        return r;
    }

    writeln(f(s) ? "Yes" : "No");
}