#include<bits/stdc++.h> usingnamespace std; #define ll long long #define inf 0x3f3f3f3f #define N 2005 int n, m, ans; int f[N][N], s[N], l[N]; char x; intmain(){ scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { scanf(" %c", &x); if (x == '.') f[i][j] = f[i - 1][j] + 1; } for (int i = 1; i <= n; i++) { int top = 0, len; for (int j = 1; j <= m; j++) { len = 0; while (s[top] > f[i][j] && top) { len += l[top]; ans = max(ans, s[top] + len); top--; } if (f[i][j]) { s[++top] = f[i][j]; l[top] = len + 1; } } len = 0; while (top) { len += l[top]; ans = max(ans, s[top] + len); top--; } } printf("%d\n", ans * 2 - 1); return0; }