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