C++ || dp || Explained solution
```\n\n/\n\nwe starting with "0" then stop, only one subsequence\n\notherwise on each position we have two choices , either take it or not take it\n\n\nBut how 
```\n\n/*\n\nwe starting with "0" then stop, only one subsequence\n\notherwise on each position we have two choices , either take it or not take it\n\n\nBut how to avoid duplicates ?\n\n\ndp[i][j]= no of distincnt subsequences starting with (i=0/1) and ends with (j=0/1) or look likes [i...j]\n\nans= dp[0][0]+dp[0][1]+dp[1][0]+dp[1][1]\n\nif s[i]==\'0\'\n\nthen we stick this \'0\' to all subsequences of type [1....0] and [1...1]\n\nso dp[1][0] increases to dp[1][0]+dp[1][1]\n\nalso we can make one subsequence of type "0" (dp[0][0])\n\nso we make dp[0][0]=1\n\n\n(NOTE subsequence of type [0...1] is not valid)\n\nif s[i]==\'1\'\n\nthen we stick this \'1\' to all subsequences of type [1...0] and [1....1] , also we\n\ncan get one new subsequence that is "1"\n\nso dp[1][1] increases to dp[1][0]+dp[1][1]+1\n\n\nans= dp[0][0]+dp[0][1]+dp[1][0]+dp[1][1]\n\n\n*/\n\nint mod=1e9+7;\n\nint dp[2][2];\n\nclass Solution {\npublic:\n    int n;\n    int numberOfUniqueGoodSubsequences(string binary) {\n      \n        memset(dp,0,sizeof(dp));\n        \n        n=binary.size();\n        \n        for(char ch:binary){\n            \n            if(ch==\'0\'){\n                dp[0][0]=1;\n                dp[1][0]=dp[1][0]+dp[1][1];\n                dp[1][0]%=mod;\n            }\n            else{\n                dp[1][1]=dp[1][0]+dp[1][1]+1;\n                dp[1][1]%=mod;\n            }\n        }\n        \n        return (dp[0][0]+dp[0][1]+dp[1][0]+dp[1][1])%mod;\n\n        \n    }\n};
[]