#P13812. [CERC 2022] Insertions
[CERC 2022] Insertions
题目描述
We are given three strings, , and . We will denote the length of a string by vertical bars, thus is the length of and so on. If we insert into at position , where , the result is a new string consisting of the first characters of , followed by the entirety of , and finally followed by the remaining characters of . We would like to select so that the resulting new string will contain the largest possible number of occurrences of as a substring.
Thus, for example, inserting into at position results in the string ; at , in the string ; and at , in the string . If we are interested in occurrences of , then the best position to insert into is , where we get two occurrences: and (as this example shows, occurrences of are allowed to overlap). If, on the other hand, we were interested in occurrences of , then the best choices of would be and , which result in one occurrence of , whereas results in 0 occurrences of .
输入格式
The first line contains the string , the second line the string , and the third line the string .
输出格式
Output one line containing the following four integers, separated by spaces:
- The maximum number of occurrences of we can get after inserting into at position , if we choose the position wisely.
- The number of different 's (from the range ) where this maximum number of occurrences of is attained.
- The minimum value of where the maximum number of occurrences of is attained.
- The maximum value of where the maximum number of occurrences of is attained.
ab
aba
aba
2 1 2 2
abaab
aba
ababa
1 3 1 5
eeoeo
eoe
eeo
2 3 1 4
提示
Comment
The first of these three examples is the one discussed earlier in the problem statement
Input limits
- All the strings consist only of lowercase letters of the English alphabet.