安徽科技工程大学程序设计在线考试系统Ver3.0

诚信考试,杜绝作弊!

问题 L: 14_C : Pattern Search

内存限制:512 MB 时间限制:3 S 标准输入输出
题目类型:传统 评测方式:文本比较

题目描述

Pattern Search 

Find places where a R × C pattern is found within a H × W region. Print top-left coordinates (i, j) of sub-regions where the pattern found. The top-left and bottom-right coordinates of the region is (0, 0) and (H-1, W-1) respectively.

输入格式

In the first line, two integers H and W are given. In the following H lines, i-th lines of the region are given. 

In the next line, two integers R and C are given. In the following R lines, i-th lines of the pattern are given.

输出格式

For each sub-region found, print a coordinate i and j separated by a space character in a line. Print the coordinates in ascending order of the row numbers (i), or the column numbers (j) in case of a tie.

输入样例 复制

4 5
00010
00101
00010
00100
3 2
10
01
10

输出样例 复制

0 3
1 2

数据范围与提示

1 ≤ H,W ≤ 1000 

1 ≤ R,C ≤ 1000 

The input consists of alphabetical characters and digits