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