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