from collections import Counter s=input() print("Yes" if s[0]==s[1] and len(Counter(s))==2 else "No")