Blogger language
Benjamin's granddaughter Brenda has a blog where she posts articles about school, friends and other life issues. Intrigued by her opinions, Benjamin tried to read it, but very soon he realized it was too hard to read because of Brenda's writing quirks.
Brenda writes without spaces or punctuation marks, and moreover, she uses lower and uppercase letters in a liberal and strange way. For example, one of her posts is "PrOgRAMmINgiSgrEAt". Benjamin has trouble noticing the words "programming", "is" and "great" when they are written in this way.
To improve his understanding Benjamin decided to do the following: he will first choose a particular string t and a blog post he is interested in; then he will select a contiguous substring of the post and search for t within the substring, in a case-insensitive way; for each occurrence of t within the substring, he will calculate the number of case mismatches, and nally he will obtain the maximum among all these values. For example, if Benjamin chooses "GR" as t and then selects the substring "PrOgRAM", he would nd a single occurrence "gR" for which the number of case mismatches is 1. For the same substring, if "r" was chosen as t, he would have found two occurrences, "r" with 0 mismatches and "R" with 1 mismatch, so the maximum number of mismatches would be 1.
To complicate things further, Brenda included in the blog a script that, after operating with a substring selection, flips the case of all the selected letters. This means that after selecting "PrOgRAM" and proceeding as explained above, the sample post would read "pRoGrammINgiSgrEAt". If Benjamin selects "ammINgi" as a second substring, after calculating his result the post would be left as "pRoGrAMMinGISgrEAt", accumulating both flips.
You will be given the string t and the original text of the blog post chosen by Benjamin. You will also be given a list of substring selections Benjamin made, in the order he made them. You need to calculate, for each selection, the maximum number of case mismatches of the occurrences of t in the selected part, considering all the case flips made by previous selections. Notice that the flipping of the case occurs after calculating the result for each selection.
Input
The first line contains an integer n (1 ≤ n ≤ 10^5) and a non-empty string t of at most 5 letters, representing respectively the number of substring selections and the string to search for. The second line contains a non-empty string P of at most 10^5 letters, indicating the original text of the blog post. Positions of the post are numbered with consecutive integers from left to right, being 1 the leftmost position and |p| the rightmost position. Each of the next n lines describes a substring selection with two integers l and r (1 ≤ l ≤ r ≤ |p|) indicating that the substring starts at position l and ends at position r, inclusive.
Output
Output n lines, each of them containing an integer. In the i-th line write the maximum number of case mismatches of the occurrences of t in the i-th substring selection, considering all the case flips made by previous selections; if no such occurrence exists write the value -1.