#C2073. Distinct Subsequences
Distinct Subsequences
Distinct Subsequences
You are given two strings, S and T. Your task is to determine the number of distinct subsequences of S that equal T. A subsequence is formed by deleting zero or more characters from S without changing the order of the remaining characters. Since the answer can be very large, output it modulo .
For example, if S = "rabbbit" and T = "rabbit", there are exactly distinct ways to form T from S.
inputFormat
The input consists of two lines:
- The first line contains the string S.
- The second line contains the target string T.
outputFormat
Output a single integer, the number of distinct subsequences of S equal to T modulo .## sample
rabbbit
rabbit
3