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