S = input() first_count = S.count(S[0]) if first_count == 2 and S[0] == S[1]: print("Yes") else: print("No")