//For higher stack size use g++ -O2 -std=c++11 -Wall -Wl,--stack=268435456 a.cpp -o a.exe in cmd
    #include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long
    #define ld long double
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;

    int ans[2001][2001];
    char ar[2001][2001];

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int n,m,i,j;
            cin>>n>>m;
            
            for(i=1;i<=n;++i)
                for(j=1;j<=m;++j)
                    cin>>ar[i][j];
            int ct=0;
            for(i=1;i<=n;++i)
            {
                ct=0;
                for(j=1;j<=m;++j)
                {
                    if(ar[i][j]=='#')
                    {
                        ans[i][j]=0;
                        ct=0;
                        continue;
                    }
                    else
                    {
                        ans[i][j]+=ct;
                        ++ct;
                    }
                }                
            }
            for(i=1;i<=n;++i)
            {
                ct=0;
                for(j=m;j>=1;--j)
                {
                    if(ar[i][j]=='#')
                    {
                        ans[i][j]=0;
                        ct=0;
                        continue;
                    }
                    else
                    {
                        ans[i][j]+=ct;
                        ++ct;
                    }
                }                
            }
            for(i=1;i<=m;++i)
            {
                ct=0;
                for(j=1;j<=n;++j)
                {
                    if(ar[j][i]=='#')
                    {
                        ans[j][i]=0;
                        ct=0;
                        continue;
                    }
                    else
                    {
                        ans[j][i]+=ct;
                        ++ct;
                    }
                }                
            }
            for(i=1;i<=m;++i)
            {
                ct=0;
                for(j=n;j>=1;--j)
                {
                    if(ar[j][i]=='#')
                    {
                        ans[j][i]=0;
                        ct=0;
                        continue;
                    }
                    else
                    {
                        ans[j][i]+=ct;
                        ++ct;
                    }
                }
            }
            int ans2=0;
            for(i=1;i<=n;++i)
            {
                for(j=1;j<=m;++j)
                {
                    if(ar[i][j]!='#')
                    {
                        ans2=max(ans2,ans[i][j]+1);
                    }
                }
            }
            cout<<ans2<<endl;
        }
        return 0;
    }


Measured memory_bytes: 19840