S = input() print("Yes" if S[0] == S[1] and len(set(S)) == 2 else "No")