https://icpcarchive.ecs.baylor.edu/external/27/2755.pdf
Input Format
Check Link In Description
Output Format
Check Link In Description
Constraints
Check Link In Description
Example
Input
2 6 baabaa 7 alabala
Output
1 6