Beats 100% Other's Solutions
\nclass Solution:\n    def numPermsDISequence(self, S: str) -> int:\n        dp = [1] * (len(S) + 1)\n        for a, b in zip(\'I\' + S, S):\n            dp = l
```\nclass Solution:\n    def numPermsDISequence(self, S: str) -> int:\n        dp = [1] * (len(S) + 1)\n        for a, b in zip(\'I\' + S, S):\n            dp = list(itertools.accumulate(dp[:-1] if a == b else dp[-1:0:-1]))\n        return dp[0] % (10**9 + 7)\n```
[]