#include <stdio.h>
#define NMax 200

int n, m;
char a[NMax][NMax];

int best[NMax][NMax];

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++) {
		scanf("%s", a[i]);
		for (int j = m; j > 0; j--) {
			a[i][j] = a[i][j-1];
		}
	}


	a[0][1] = '.';
	int mmax = 0;

	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (a[i][j] == '.') {
				if (a[i-1][j] == '.') {
					best[i][j] = best[i-1][j] + 1;
				}

				if (a[i][j-1] == '.' && best[i][j] < best[i][j-1] + 1) {
					best[i][j] = best[i][j-1] + 1;
				}

				if (best[i][j] > mmax) {
					mmax = best[i][j];
				}
			}
		}
	}
	printf("%d\n", mmax);

	return 0;
}