LearnPy Hub
← Arena
AdvancedRating 1600

How Many Times as a Subsequence?

Count the ways to delete characters from s to get t (the number of times t appears in s as a subsequence), modulo 1 000 000 007.

Input

s, then t (lengths ≤ 1000).

Output

One integer.

Sample 1

Input
rabbbit
rabbit
Output
3

Sample 2

Input
babgbag
bag
Output
5
solution.py
Output appears here
How Many Times as a Subsequence? · Python Arena problem · LearnPy Hub