S = input() ans = "Yes" if len(S) != 3: ans = "No" if len(set(S)) != 2: ans = "No" if not S: ans = "No" print(ans)