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