253. Distinct Subsequence Count
HardDynamic ProgrammingCounting
Count how many times t appears as a subsequence of s (different index sets count separately). Print modulo 10⁹ + 7.
Input format
Line 1: s Line 2: t
Output format
The count mod 10⁹ + 7.
Example 1
Input
rabbbit rabbit
Output
3
Example 2
Input
babgbag bag
Output
5
Constraints
1 ≤ |s|, |t| ≤ 1000
Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.
Loading the MyLoginn IDE…