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