B. Maximum Sub-Reverse Matching
time limit per test
3 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output
Example
Input
5
11
happycoding
onedocument
8
abbbcccd
xcbcbybd
3
cat
dog
4
abcd
xyza
3
dog
pop
Output
2 4 4 8
2 5 2 7
0 0 1 1
0 1 1 4
1 1 1 1