1 #include<iostream>
2 using namespace std;
3 int a[2001][2001],up[2001][2001],st[2001][2001];
4 int main ()
5 {
6 int n,m;
7 char c;
8 cin>>n>>m;
9 for (int i=1;i<=n;i++)
10 {
11 for (int j=1;j<=m;j++)
12 {
13 cin>>c;
14 if (c=='.')
15 {
16 a[i][j]=1;
17 up[i][j]=up[i-1][j]+1;
18 }
19 else a[i][j]=0;
20 }
21 }
22 int ans=0;
23 for (int i=1;i<=n;i++)
24 {
25 int top=0,w[55]={0},q[55]={0};
26 for (int j=1,h=0;j<=m+1;j++)
27 {
28 if (j!=m+1) h=up[i][j];
29 else h=0;
30 if (h>q[top])
31 q[++top]=h,w[top]=1;
32 else
33 {
34 int cnt=0;
35 while (h<=q[top]&&top>=1)
36 {
37 ans=max(ans,2*(w[top]+cnt)+2*q[top]);
38 cnt+=w[top--];
39 }
40 if (j!=m+1&&a[i][j]!=0) q[++top]=h,w[top]=cnt+1;
41 }
42 }
43 }
44 cout<<ans-1;
45 }