# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
S = np.array(['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)])
S = np.array([[x == '.' for x in row] for row in S])
S = S.astype(np.int16)
left = S.copy(); right = S.copy(); up = S.copy(); down = S.copy()
for i in range(1, W+1):
    left[:, i] += left[:, i-1]
    left[:, i] *= S[:, i]
for i in range(W, 0, -1):
    right[:, i] += right[:, i+1]
    right[:, i] *= S[:, i]
for i in range(1, H+1):
    up[i, :] += up[i-1, :]
    up[i, :] *= S[i, :]
for i in range(H, 0, -1):
    down[i, :] += down[i+1, :]
    down[i, :] *= S[i, :]

answer = (left + right + up + down - 3).max()
print(answer) import sys sys import numpy as np numpy sr = lambda: sys.stdin.readline().rstrip() sr lambda: sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip ir = lambda: int(sr()) ir lambda: int(sr()) int(sr()) int sr() sr lr = lambda: list(map(int, sr().split())) lr lambda: list(map(int, sr().split())) list(map(int, sr().split())) list map(int, sr().split()) map int sr().split() ().split () sr split H, W = lr() H lr() lr W '#' + sr() + '#' for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) '#' + sr() + '#' '#' + sr() '#' sr() sr '#' S = np.array(['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)]) S np.array(['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)]) np.array np array ['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)] ['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] ['#' * (W+2)] '#' * (W+2) '#' W+2 W 2 ['#' + sr() + '#' for _ in range(H)] ['#' * (W+2)] '#' * (W+2) '#' W+2 W 2 [x == '.' for x in row] for row in S for row in S row S for row in S [x == '.' for x in row] S = np.array([[x == '.' for x in row] for row in S]) S np.array([[x == '.' for x in row] for row in S]) np.array np array [[x == '.' for x in row] for row in S] S = S.astype(np.int16) S S.astype(np.int16) S.astype S astype np.int16 np int16 left = S.copy() left S.copy() S.copy S copy right = S.copy() right S.copy() S.copy S copy up = S.copy() up S.copy() S.copy S copy down = S.copy() down S.copy() S.copy S copy for i in range(1, W+1):
    left[:, i] += left[:, i-1]
    left[:, i] *= S[:, i] i range(1, W+1) range 1 W+1 W 1 left[:, i] += left[:, i-1] left[:, i] left : left[:, i-1] left : left[:, i] *= S[:, i] left[:, i] left : S[:, i] S : for i in range(W, 0, -1):
    right[:, i] += right[:, i+1]
    right[:, i] *= S[:, i] i range(W, 0, -1) range W 0 -1 right[:, i] += right[:, i+1] right[:, i] right : right[:, i+1] right : right[:, i] *= S[:, i] right[:, i] right : S[:, i] S : for i in range(1, H+1):
    up[i, :] += up[i-1, :]
    up[i, :] *= S[i, :] i range(1, H+1) range 1 H+1 H 1 up[i, :] += up[i-1, :] up[i, :] up i up[i-1, :] up i-1 i 1 up[i, :] *= S[i, :] up[i, :] up i S[i, :] S i for i in range(H, 0, -1):
    down[i, :] += down[i+1, :]
    down[i, :] *= S[i, :] i range(H, 0, -1) range H 0 -1 down[i, :] += down[i+1, :] down[i, :] down i down[i+1, :] down i+1 i 1 down[i, :] *= S[i, :] down[i, :] down i S[i, :] S i answer = (left + right + up + down - 3).max() answer (left + right + up + down - 3).max() left + right + up + down - 3).max left + right + up + down - 3 left + right + up + down left + right + up left + right left right up down 3 max print(answer) print answer up = S.copy() S.copy() up W = lr() lr() W ir = lambda: int(sr()) lambda: int(sr()) ir S = S.astype(np.int16) S.astype(np.int16) S answer = (left + right + up + down - 3).max() (left + right + up + down - 3).max() answer H, W = lr() lr() H sr = lambda: sys.stdin.readline().rstrip() lambda: sys.stdin.readline().rstrip() sr S = np.array([[x == '.' for x in row] for row in S]) np.array([[x == '.' for x in row] for row in S]) S down = S.copy() S.copy() down lr = lambda: list(map(int, sr().split())) lambda: list(map(int, sr().split())) lr right = S.copy() S.copy() right S = np.array(['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)]) np.array(['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)]) S left = S.copy() S.copy() left
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

H, W = lr()
S = np.array(['#' * (W+2)] + ['#' + sr() + '#' for _ in range(H)] + ['#' * (W+2)])
S = np.array([[x == '.' for x in row] for row in S])
S = S.astype(np.int16)
left = S.copy(); right = S.copy(); up = S.copy(); down = S.copy()
for i in range(1, W+1):
    left[:, i] += left[:, i-1]
    left[:, i] *= S[:, i]
for i in range(W, 0, -1):
    right[:, i] += right[:, i+1]
    right[:, i] *= S[:, i]
for i in range(1, H+1):
    up[i, :] += up[i-1, :]
    up[i, :] *= S[i, :]
for i in range(H, 0, -1):
    down[i, :] += down[i+1, :]
    down[i, :] *= S[i, :]

answer = (left + right + up + down - 3).max()
print(answer)
