Guest User

Untitled

a guest
Nov 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. # coding: utf-8
  2. def match(ofs_x, ofs_y, li_A, li_B):
  3. for a, b in zip(li_A[ofs_y:], li_B):
  4. if a[ofs_x:ofs_x + M] != b:
  5. return False
  6. return True
  7.  
  8. N, M = map(int, input().split())
  9. li_A = [input() for _ in range(N)]
  10. li_B = [input() for _ in range(M)]
  11.  
  12. for y in range(N-M+1):
  13. for x in range(N-M+1):
  14. if match(x, y, li_A, li_B):
  15. print("Yes")
  16. exit()
  17. print("No")
Add Comment
Please, Sign In to add comment