#pragma GCC optimize ("O3") #pragma GCC target ("avx") #include using namespace std; short h, w, dp[3001]; char g[3001]; int main() { cin >> h >> w; cin.ignore(); short ans = 0; for (int i = 0; i < h; i++) { gets(g); // a dp0[i] // b dp1[i] // x = min(a, b) short x = 0; for (int j = 0; j < w; j++) { short tmp = dp[j]; dp[j] = g[j] == '.' ? 0 : min(x, dp[j]) + 1; x = min(tmp, dp[j]); ans = max(ans, dp[j]); } } cout << (ans + 1) / 2 << endl; }