C++ Dp solution
\nclass Solution {\npublic:\n    int mod = 1e9 + 7;\n    #define ll long long\n    int numberOfUniqueGoodSubsequences(string binary) {\n        int len = binary
```\nclass Solution {\npublic:\n    int mod = 1e9 + 7;\n    #define ll long long\n    int numberOfUniqueGoodSubsequences(string binary) {\n        int len = binary.length();\n        vector<ll> dp(len + 1);\n        ll ans = 0;\n        \n        int last_occ_1 = 0;\n        int last_occ_0 = 0;\n        \n        int i = 0;\n        while(binary[i] == \'0\') i++;\n        \n        i = max(i, 1);\n        for(i; i <= len; i++) {\n            dp[i] = (2*dp[i - 1]) % mod;\n            \n            if(binary[i - 1] == \'0\') {\n                if(last_occ_0) dp[i]-=dp[last_occ_0 - 1];\n                \n                last_occ_0 = i;\n            } else {\n                if(last_occ_1) dp[i]-=dp[last_occ_1- 1];\n                else dp[i] = (dp[i] % mod + 1) % mod;\n                \n                last_occ_1 = i;\n            }\n            if(dp[i] < 0) dp[i]+=mod;\n        }\n        \n        for(char c : binary) {\n            if(c == \'0\') {\n                dp[len]++;\n                break;\n            }\n        }\n        \n        return dp[len];\n    }\n};\n```
[]