# -*- coding: utf-8 -*-



import numpy as np



### TESTCASE

test = ""

#test = \

"""

4 6

#..#..

.....#

....#.

#.#...

ans 8

"""



"""

8 8

..#...#.

....#...

##......

..###..#

...#..#.

##....#.

#...#...

###.#..#

ans 13

"""

############

test = list(reversed(test.strip().splitlines()))

if test:

    def input2():

        return test.pop()

else:

    def input2():

        return eval(input())

####### MAIN



h, w = list(map(int, input2().split()))

s = [["#"] * (w+1)]

s += [list("#" + input2()) for _ in range(h)]

s = np.array(s)



hs = np.zeros((h+1, w+1), dtype="int64")

ws = np.zeros((h+1, w+1), dtype="int64")



for hi in range(1, h+1):

    htmp = np.array(s[hi] == ".", dtype="int")

    hs[hi] = hs[hi-1] * htmp + htmp

    

for hj in range(h-1, 0, -1):

    hs[hj] = np.maximum(hs[hj], np.minimum(hs[hj+1], hs[hj] * hs[hj+1]))

    

for wi in range(1, w+1):

    wtmp = np.array(s[:, wi] == ".", dtype="int")

    ws[:, wi] = ws[:, wi-1] * wtmp + wtmp

    

for wj in range(w-1, 0, -1):

    ws[:, wj] = np.maximum(ws[:, wj], 

      np.minimum(ws[:, wj+1], ws[:, wj] * ws[:, wj+1]))

    

print((np.max(ws + hs) - 1))    

    

    



import numpy as np

h, w = list(map(int, input().split()))

grid = np.array([list(eval(input())) for _ in range(h)], dtype="str")



hgrid = np.zeros((h, w), dtype="int")



for hi in range(h):

    hdot = np.array(grid[hi] == ".", dtype="int")

    hgrid[hi] = hgrid[hi-1] * hdot + hdot

    

for hi in range(h-2, -1, -1):

    hi_1 = np.minimum(hgrid[hi+1], hgrid[hi] * hgrid[hi+1])

    hgrid[hi] = np.maximum(hgrid[hi], hi_1)

    

wgrid = np.zeros((h, w), dtype="int")



for wi in range(w):

    wdot = np.array(grid[:, wi] == ".", dtype="int")

    wgrid[:, wi] = wgrid[:, wi-1] * wdot + wdot

    

for wi in range(w-2, -1, -1):

    wi_1 = np.minimum(wgrid[:, wi+1], wgrid[:, wi] * wgrid[:, wi+1])

    wgrid[:, wi] = np.maximum(wgrid[:, wi], wi_1)



print((np.max(wgrid + hgrid) - 1))
# -*- coding: utf-8 -*-
import numpy as np

### TESTCASE
test = ""
# test = \
"""
4 6
#..#..
.....#
....#.
#.#...
ans 8
"""
"""
8 8
..#...#.
....#...
##......
..###..#
...#..#.
##....#.
#...#...
###.#..#
ans 13
"""
############
test = list(reversed(test.strip().splitlines()))
if test:

    def input2():
        return test.pop()

else:

    def input2():
        return eval(input())


####### MAIN
h, w = list(map(int, input2().split()))
s = [["#"] * (w + 1)]
s += [list("#" + input2()) for _ in range(h)]
s = np.array(s)
hs = np.zeros((h + 1, w + 1), dtype="int64")
ws = np.zeros((h + 1, w + 1), dtype="int64")
for hi in range(1, h + 1):
    htmp = np.array(s[hi] == ".", dtype="int")
    hs[hi] = hs[hi - 1] * htmp + htmp
for hj in range(h - 1, 0, -1):
    hs[hj] = np.maximum(hs[hj], np.minimum(hs[hj + 1], hs[hj] * hs[hj + 1]))
for wi in range(1, w + 1):
    wtmp = np.array(s[:, wi] == ".", dtype="int")
    ws[:, wi] = ws[:, wi - 1] * wtmp + wtmp
for wj in range(w - 1, 0, -1):
    ws[:, wj] = np.maximum(
        ws[:, wj], np.minimum(ws[:, wj + 1], ws[:, wj] * ws[:, wj + 1])
    )
print((np.max(ws + hs) - 1))

import numpy as np

h, w = list(map(int, input().split()))
grid = np.array([list(eval(input())) for _ in range(h)], dtype="str")
hgrid = np.zeros((h, w), dtype="int")
for hi in range(h):
    hdot = np.array(grid[hi] == ".", dtype="int")
    hgrid[hi] = hgrid[hi - 1] * hdot + hdot
for hi in range(h - 2, -1, -1):
    hi_1 = np.minimum(hgrid[hi + 1], hgrid[hi] * hgrid[hi + 1])
    hgrid[hi] = np.maximum(hgrid[hi], hi_1)
wgrid = np.zeros((h, w), dtype="int")
for wi in range(w):
    wdot = np.array(grid[:, wi] == ".", dtype="int")
    wgrid[:, wi] = wgrid[:, wi - 1] * wdot + wdot
for wi in range(w - 2, -1, -1):
    wi_1 = np.minimum(wgrid[:, wi + 1], wgrid[:, wi] * wgrid[:, wi + 1])
    wgrid[:, wi] = np.maximum(wgrid[:, wi], wi_1)
print((np.max(wgrid + hgrid) - 1))

-# -*- coding: utf-8 -*- -### TESTCASE -test = "" -# test = \ -""" -4 6 -#..#.. -.....# -....#. -#.#... -ans 8 -""" -""" -8 8 -..#...#. -....#... -##...... -..###..# -...#..#. -##....#. -#...#... -###.#..# -ans 13 -""" -############ -test = list(reversed(test.strip().splitlines())) -if test: - -    def input2(): -        return test.pop() - -else: - -    def input2(): -        return eval(input()) - - -####### MAIN -h, w = list(map(int, input2().split())) -s = [["#"] * (w + 1)] -s += [list("#" + input2()) for _ in range(h)] -s = np.array(s) -hs = np.zeros((h + 1, w + 1), dtype="int64") -ws = np.zeros((h + 1, w + 1), dtype="int64") -for hi in range(1, h + 1): -    htmp = np.array(s[hi] == ".", dtype="int") -    hs[hi] = hs[hi - 1] * htmp + htmp -for hj in range(h - 1, 0, -1): -    hs[hj] = np.maximum(hs[hj], np.minimum(hs[hj + 1], hs[hj] * hs[hj + 1])) -for wi in range(1, w + 1): -    wtmp = np.array(s[:, wi] == ".", dtype="int") -    ws[:, wi] = ws[:, wi - 1] * wtmp + wtmp -for wj in range(w - 1, 0, -1): -    ws[:, wj] = np.maximum( -        ws[:, wj], np.minimum(ws[:, wj + 1], ws[:, wj] * ws[:, wj + 1]) -    ) -print((np.max(ws + hs) - 1)) +h, w = list(map(int, input().split())) +grid = np.array([list(eval(input())) for _ in range(h)], dtype="str") +hgrid = np.zeros((h, w), dtype="int") +for hi in range(h): +    hdot = np.array(grid[hi] == ".", dtype="int") +    hgrid[hi] = hgrid[hi - 1] * hdot + hdot +for hi in range(h - 2, -1, -1): +    hi_1 = np.minimum(hgrid[hi + 1], hgrid[hi] * hgrid[hi + 1]) +    hgrid[hi] = np.maximum(hgrid[hi], hi_1) +wgrid = np.zeros((h, w), dtype="int") +for wi in range(w): +    wdot = np.array(grid[:, wi] == ".", dtype="int") +    wgrid[:, wi] = wgrid[:, wi - 1] * wdot + wdot +for wi in range(w - 2, -1, -1): +    wi_1 = np.minimum(wgrid[:, wi + 1], wgrid[:, wi] * wgrid[:, wi + 1]) +    wgrid[:, wi] = np.maximum(wgrid[:, wi], wi_1) +print((np.max(wgrid + hgrid) - 1))