Count Distinct Subsequences check if 01 or 00 seen
\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        M = 10 ** 9 + 7\n        n = len(binary)\n        dp = [1] * (n + 
```\nclass Solution:\n    def numberOfUniqueGoodSubsequences(self, binary: str) -> int:\n        M = 10 ** 9 + 7\n        n = len(binary)\n        dp = [1] * (n + 1)\n        prev = {}\n        zerozero = False\n        zeroone = False\n        for i in range(1, n + 1):\n            dp[i] = 2 * dp[i - 1]\n            if binary[i - 1] in prev:\n                dp[i] -= dp[prev[binary[i - 1]]]\n            if "0" in prev:\n                if binary[i - 1] == "0" and not zerozero:\n                    dp[i] -= 1\n                    zerozero = True\n                if binary[i - 1] == "1" and not zeroone:\n                    dp[i] -= 1\n                    zeroone = True\n            dp[i] %= M\n            prev[binary[i - 1]] = i - 1\n        dp[n] = (M + dp[n] - 1) % M\n \xA0 \xA0 \xA0 \xA0return dp[n] \n```
[]