Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rows, cols = [int(n) for n in input().split()]
- matrix = [input().split() for i in range(rows)]
- identical_squares = 0
- for i in range(rows - 1):
- for j in range(len(matrix[i])-1):
- current_symbol = matrix[i][j]
- if matrix[i][j+1] == current_symbol and matrix[i+1][j] == current_symbol and matrix[i+1][j+1] == current_symbol:
- identical_squares += 1
- print(identical_squares)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement