2 10 10 1 xxxxxxxxxx xbcdxxxxxx xaxxxdcbax xxxdxxxxxx xxxcbaxxxx xxxxxxabxx xaxaxxdcxx xbxbxxxxdc xcxcxxxxxb xdxdxxxxxa abcd 5 5 2 xsssx xxbxx xbabx xxbxx xxxxx ab sss
6 4 1 Hint Explanation for the second testcase: For pattern ab , the occurences are { (2, 3), (3, 3) }, { (3, 2), (3, 3) }, { (3, 3), (3, 4) }, { (3, 3), (4, 3) }. For pattern sss , the only occurence is { (1, 2), (1, 3), (1, 4) }.