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