#P7420. 「PMOI-2」拆分
「PMOI-2」拆分
Background
If you do not read the hints in the sample explanation, you will most likely be unable to solve it.

Problem Description
lhm has a string and its substring . Now you need to split the string .
Let denote the maximum number of substrings that can be selected from string such that they are pairwise non-overlapping and equal to .
If we split into groups, and denote the -th group as , you need to ensure:
- ,
- ,
- .
Two splitting plans are different if and only if the number of groups after splitting is different, or such that the corresponding values are different.
Find the total number of different splitting plans, and output the answer modulo .
Input Format
The input consists of two lines.
The first line contains a string , with the meaning as described in the problem.
The second line contains a string , with the meaning as described in the problem.
Output Format
The output consists of one line.
Print one integer, representing the number of splitting plans modulo .
noinoinonoinoiionoinoinoionoi
noi
10
Hint
[Sample Explanation]
The splitting methods are:
noi noinonoi noiionoinoinoionoi, with counts .
noi noinonoin oiionoinoinoionoi, with counts .
noino inonoinoiion oinoinoionoi, with counts .
noi noinonoinoi ionoinoinoionoi, with counts .
noi noinonoinoiionoinoinoionoi, with counts .
noinoi nonoinoiionoinoinoionoi, with counts .
noinoinonoi noiionoinoinoionoi, with counts .
noin oinonoinoiionoinoinoionoi, with counts .
noinoinono inoiionoinoinoionoi, with counts .
noinoinonoin oiionoinoinoionoi, with counts .
Hint: The sample explanation is enough to show that splitting inside a substring is allowed.
[Constraints]
Please read this section carefully.
This problem uses bundled testdata.
Let , , and .
| Subtask | Special Property | Memory Limit | Score |
|---|---|---|---|
| 1 | 256MiB | 9 | |
| 2 | 11 | ||
| 3 | 17 | ||
| 4 | 37 | ||
| 5 | None | 64MiB | 26 |
For of the testdata, , , , and both and contain only lowercase letters.
Translated by ChatGPT 5