#P1819. 公共子序列
公共子序列
Description
Find how many distinct common subsequences the character sequences share, excluding the empty sequence.
Input Format
The first line contains a positive integer , denoting the length of the sequences.
The next lines each contain a length- character sequence without spaces. Only lowercase letters a to z are used.
Output Format
One line with a positive integer , taken modulo .
4
aabb
abab
baba
5
Hint
Sample 1 Explanation
For the single sample, there are subsequences: a, ab, aa, bb, b.
Constraints and Conventions
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
- For of the testdata, it is guaranteed that .
Translated by ChatGPT 5
京公网安备 11011102002149号