output_description: Print the number of operations that will be performed.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      H W
      A_{11}A_{12}...A_{1W}
      :
      A_{H1}A_{H2}...A_{HW}
attempt: from sys import stdin
  
  readline = stdin.readline
  H, W = map(int, input().split())
  A = ["" for i in range(H)]
  colors = [[-2 for j in range(W)] for i in range(H)]
  q = []
  for i in range(H):
      A[i] = list(readline())
      for j, color in enumerate(A[i]):
          colors[i][j] = 0 if color == "#" else -1
          if "#" == color:
              q.append([i, j, 0])
              colors[i][j] = 0
  # for i in colors:
  #     print(i)
  mx = 0
  direction = [[1, 0], [0, 1], [-1, 0], [0, -1]]
  
  while len(q) > 0:
      # print(q)
      tmp = [y, x, op] = q.pop(0)
      mx = max(mx, op)
      if colors[y][x] >= 0 and mx > 0:
          continue
      for [dx, dy] in direction:
          ny, nx = y + dy, x + dx
          if 0 <= ny and ny < H and 0 <= nx and nx < W:
              if A[ny][nx] == "#" or colors[ny][nx] >= 0:
                  continue
              q.append([ny, nx, op + 1])
              colors[y][x] = op + 1
  print(mx)
  
problem_description: Statement
  
  You are given a grid of squares with H horizontal rows and W vertical columns,
  where each square is painted white or black. HW characters from A_{11} to
  A_{HW} represent the colors of the squares. A_{ij} is `#` if the square at the
  i-th row from the top and the j-th column from the left is black, and A_{ij}
  is `.` if that square is white.
  
  We will repeatedly perform the following operation until all the squares are
  black:
  
    * Every white square that shares a side with a black square, becomes black.
  
  Find the number of operations that will be performed. The initial grid has at
  least one black square.
samples: [{"input": "3 3\n    ...\n    .#.\n    ...", "output": "2\n    \n\nAfter one operation, all but the corners of the grid will be black. After one\nmore operation, all the squares will be black.\n\n* * *"}, {"input": "6 6\n    ..#..#\n    ......\n    #..#..\n    ......\n    .#....\n    ....#.", "output": "3"}]