#include #include using namespace std; #define N_MAX 105 char A[N_MAX][N_MAX]; short int B[N_MAX][N_MAX]; int n, m; int main() { //freopen("input", "r", stdin); //freopen("output", "w", stdout); scanf("%d%d\n", &n, &m); for (int i = 1; i <= n; i++) { fgets(A[i] + 1, N_MAX - 1, stdin); } for (int i = 0; i <= max(n, m); i++) { B[i][0] = B[0][i] = -200; } int sol = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { B[i][j] = -200; } } B[1][1] = (A[1][1] == '.'); for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { if (A[i][j] != '.') { continue; } if (A[i-1][j] == '.' && B[i-1][j] + 1 > B[i][j]) { B[i][j] = B[i-1][j] + 1; } if (A[i][j-1] == '.' && B[i][j-1] + 1 > B[i][j]) { B[i][j] = B[i][j-1] + 1; } if (B[i][j] > sol) sol = B[i][j]; } } printf("%d\n", sol); return 0; }