🔥 First Javascript Solution
\nfunction numPermsDISequence(s) {\n    let mod = 1e9 + 7, dp = [[1], []], res = 0\n\n    for (let i = 1; i <= S.length; i++) {\n        for (let j = 0; j <= i;
```\nfunction numPermsDISequence(s) {\n    let mod = 1e9 + 7, dp = [[1], []], res = 0\n\n    for (let i = 1; i <= S.length; i++) {\n        for (let j = 0; j <= i; j++) {\n            let l = 0,  r = j\n            if (s.charAt(i-1) === \'D\') {\n                l = j, r = i\n            }\n            dp[1][j] = 0\n            for (let k = l; k < r; k++) {\n                dp[1][j] += dp[0][k]\n                dp[1][j] %= mod\n            }\n        }\n        [dp[0], dp[1]] = [dp[1], dp[0]]\n    }\n\n    for (let cnt of dp.shift()) {\n        res += cnt\n        res %= mod\n    }\n    return res\n}\n```
['JavaScript']