Problem
Given strings s and t, return the number of distinct ways to pick characters from s (keeping their order) that spell out exactly t. Two ways are different if they use a different set of positions in s.
Example 1
- Input
- s = "rabbbit", t = "rabbit"
- Output
- 3
- Why
- drop any one of the three b's
Example 2
- Input
- s = "babgbag", t = "bag"
- Output
- 5
Constraints
1 <= s.length, t.length <= 1000Both strings contain only English letters.The answer fits in a 32-bit signed integer.