#include #define NMax 110 #define MMax 110 using namespace std; char a[NMax][MMax]; int dp[NMax][MMax]; int n, m; void Bordare() { int i, n1 = n + 1, m1 = m + 1; for (i = 0; i<=n1; ++i) a[i][0] = a[i][m1] = '&'; for (i = 0; i<=m1; ++i) a[0][i] = a[n1][i] = '&'; } int main() { cin>>n>>m; for (int i = 1; i<=m; ++i) cin>>(a[i] + 1); Bordare(); dp[1][1] = 1; int ans = 1; if (a[1][1] == '&') { cout<<0<<"\n"; return 0; } for (int i = 1; i<=n; ++i) for (int j = 1; j<=m; ++j) { if (dp[i][j]) continue; if (a[i][j] == '&') continue; if (a[i][j-1] == '.' && dp[i][j-1]) dp[i][j] = max(dp[i][j], dp[i][j-1] + 1); if (a[i-1][j] == '.' && dp[i-1][j]) dp[i][j] = max(dp[i][j], dp[i-1][j] + 1); ans = max(ans, dp[i][j]); } cout<