def INT(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) S = input() if len(set(S)) == 2 and S[0] == S[1]: print("Yes") else: print("No")