S = input() flag = "No" if len(S) == 3: if S[0] == S[1] and S[1] != S[2]: flag = "Yes" print(flag)