#include #define IN(x,s,g) ((x) >= (s) && (x) < (g)) #define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h))) #include #include #define REP(i,n) for(int i=0; i<(int)(n); i++) #include inline int getInt(){ int s; scanf("%d", &s); return s; } #include using namespace std; int d[3010][3010]; char g[3010][3010]; inline int get(int x, int y, int w, int h) { return ISIN(x, y, w, h) ? d[y][x] : 0; } int main(){ const int h = getInt(); const int w = getInt(); REP(i,h) scanf("%s", g[i]); int ans = 0; REP(i,h) REP(j,w) { if (g[i][j] == '.') d[i][j] = 0; else d[i][j] = min(get(j - 1, i, w, h), min(get(j, i - 1, w, h), get(j - 1, i - 1, w, h))) + 1; ans = max(ans, d[i][j]); } // REP(i,h) { REP(j,w) printf("%02d ", d[i][j]); puts(""); } printf("%d\n", (ans + 1) / 2); return 0; }