import java.io.PrintWriter; import java.util.LinkedList; import java.util.Scanner; public class Main { static Scanner scan = new Scanner(System.in); static PrintWriter out = new PrintWriter(System.out); static int H, W; static char[][] map; static int [][] ansMap; static int ans = 0; public static void main(String[] args) { String line = scan.nextLine(); String values[] = line.split(" "); H = Integer.parseInt(values[0]); W = Integer.parseInt(values[1]);; LinkedList q = new LinkedList<>(); map = new char[H+2][W+2]; ansMap = new int[H+2][W+2]; for(int i=0; i= 0 && nextX < map[0].length && nextY >= 0 && nextY < map.length) { if(map[nextY][nextX] == '#' && ansMap[nextY][nextX] == 0) { ansMap[nextY][nextX] = ansMap[now.y][now.x] + 1; q.add(new Point(nextX, nextY)); ans = Math.max(ans, ansMap[nextY][nextX]); } } } } System.out.println(ans); } static void out() { for(int i=0; i