Problems
Pattern matching
Pattern matching
String contains characters of two disjoint alphabets \textbf{А_1} and \textbf{А_2}. Two strings are considered equal if there is a one-to-one mapping of the alphabet \textbf{А_2} to itself which, when applied to the first string, produces the second string.
Under this definition of string equality we say that for a given pattern there is its occurrence in a string, if there is a substring in a string equal to the pattern.
For a given string and a pattern count the number of occurrences of the pattern in the string.
\InputFile
The first line of the input file contains two integers \textbf{N} and \textbf{M} --- the number of characters in the first and second alphabets, respectively (\textbf{1} ≤ \textbf{N}, \textbf{M} < \textbf{52}).
The following two lines contain characters from the alphabets \textbf{A_1} and \textbf{A_2}. without spaces. Characters from the alphabets are Latin, lowercase or capitalized. The fourth line contains the string, and the fifth contains pattern.
The lengths of the string and pattern do not exceed \textbf{10^5}.
\OutputFile
The output file must contain a single integer --- the number of times the pattern appears in the string.
Input example #1
8 4 aIbctlyd eouh Itellyeh you
Output example #1
1