https://www.acmicpc.net/problem/3187import sysfrom collections import dequeinput = sys.stdin.readlineR, C = map(int, input().split())map = []for i in range(R): map.append(list(input().strip()))visited = [[0] * C for i in range(R)]dx = [-1, 1, 0, 0]dy = [0, 0, -1, 1]wolf = 0sheep = 0queue = deque()def bfs(i, j): queue.append((i, j)) visited[i][j] = 1 wolf_count, sheep_count = 0, 0 ..