TopCoder

User's AC Ratio

NaN% (0/0)

Submission's AC Ratio

NaN% (0/0)

Tags

Description

Given an N * M matrix, your task is to find the number of occurences of an X * Y pattern.

Input Format

The first line contains a single integer t(t ≤ 15), the number of test cases.


For each case, the first line contains two integers N and M (N, M ≤ 1000). The next N lines contain M characters each.


The next line contains two integers X and Y (X, Y ≤ 100). The next X lines contain Y characters each. Every character in the matrix is a lower case English letter.

Output Format

For each case, output a single integer in its own line, the number of occurrences.

Sample Input 1

2
1 1
x
1 1
y
3 3
abc
bcd
cde
2 2
bc
cd

Sample Output 1

0
2

Hints

Problem Source

Migrated from old NTUJ.

UVa 11019

Subtasks

No. Testdata Range Score

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 10000 65536 200