Concating substring - MarisaOJ: Marisa Online Judge

Concating substring

Time limit: 1000 ms
Memory limit: 256 MB
Given two strings $A$ and $B$, count the number of different ways to choose $k$ non-overlapping consecutive substrings from $A$ to concatenate and form the string $B$. The chosen substrings must maintain their relative order. ### Input - The first line contains an integer $n,m,k$. - The second line contains the string $A$ of length $n$. - The third line contains the string $B$ of length $m$. ### Output - A single integer representing the number of different ways to choose $k$ non-overlapping consecutive substrings from $A$ to form the string $B$, modulo $10^9+7$. ### Constraints - $1 \le |A| \le 1000$ - $1 \le |B| \le 200$ - $1 \le k \le |B|$ ### Example Input: ``` 6 3 2 aabaab aab ``` Output: ``` 7 ```