Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # coding: utf-8
- def match(ofs_x, ofs_y, li_A, li_B):
- for a, b in zip(li_A[ofs_y:], li_B):
- if a[ofs_x:ofs_x + M] != b:
- return False
- return True
- N, M = map(int, input().split())
- li_A = [input() for _ in range(N)]
- li_B = [input() for _ in range(M)]
- for y in range(N-M+1):
- for x in range(N-M+1):
- if match(x, y, li_A, li_B):
- print("Yes")
- exit()
- print("No")
Add Comment
Please, Sign In to add comment