import numpy as np

import sys

def main():

    line = sys.stdin.readline



    H, W = list(map(int, line().split()))

    grid = np.zeros((H + 2, W + 2), np.int32)

    grid[1:-1, 1:-1] = (np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == '.') * 1

    left = np.zeros((H + 2, W + 2), np.int32)

    right = np.zeros((H + 2, W + 2), np.int32)

    up = np.zeros((H + 2, W + 2), np.int32)

    down = np.zeros((H + 2, W + 2), np.int32)



    # 下方向に照らせるマスの数（自分の場所含む）

    down[H] = grid[H]

    for i in range(H, 0, -1):

        down[i - 1] = (down[i] + 1) * grid[i - 1]



    up[1] = grid[1]

    for i in range(1, H):

        up[i + 1] = (up[i] + 1) * grid[i + 1]



    right[:, W] = grid[:, W]

    for i in range(W, 0, -1):

        right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]



    left[:, 1] = grid[:, 1]

    for i in range(1, W):

        left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]



    answer = (left + right + up + down) * grid

    print((np.max(answer) - 3))





if __name__ == '__main__':

    main()
import numpy as np

import sys

line = sys.stdin.readline



H, W = list(map(int, line().split()))

grid = np.zeros((H + 2, W + 2), np.int32)

grid[1:-1, 1:-1] = (np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == '.') * 1

left = np.zeros((H + 2, W + 2), np.int32)

right = np.zeros((H + 2, W + 2), np.int32)

up = np.zeros((H + 2, W + 2), np.int32)

down = np.zeros((H + 2, W + 2), np.int32)



# 下方向に照らせるマスの数（自分の場所含む）

down[H] = grid[H]

for i in range(H, 0, -1):

    down[i - 1] = (down[i] + 1) * grid[i - 1]



up[1] = grid[1]

for i in range(1, H):

    up[i + 1] = (up[i] + 1) * grid[i + 1]



right[:, W] = grid[:, W]

for i in range(W, 0, -1):

    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]



left[:, 1] = grid[:, 1]

for i in range(1, W):

    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]



answer = (left + right + up + down - 3) * grid

print((np.max(answer)))
import numpy as np
import sys


def main():
    line = sys.stdin.readline
    H, W = list(map(int, line().split()))
    grid = np.zeros((H + 2, W + 2), np.int32)
    grid[1:-1, 1:-1] = (
        np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "."
    ) * 1
    left = np.zeros((H + 2, W + 2), np.int32)
    right = np.zeros((H + 2, W + 2), np.int32)
    up = np.zeros((H + 2, W + 2), np.int32)
    down = np.zeros((H + 2, W + 2), np.int32)
    # 下方向に照らせるマスの数（自分の場所含む）
    down[H] = grid[H]
    for i in range(H, 0, -1):
        down[i - 1] = (down[i] + 1) * grid[i - 1]
    up[1] = grid[1]
    for i in range(1, H):
        up[i + 1] = (up[i] + 1) * grid[i + 1]
    right[:, W] = grid[:, W]
    for i in range(W, 0, -1):
        right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]
    left[:, 1] = grid[:, 1]
    for i in range(1, W):
        left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]
    answer = (left + right + up + down) * grid
    print((np.max(answer) - 3))


if __name__ == "__main__":
    main()

import numpy as np
import sys

line = sys.stdin.readline
H, W = list(map(int, line().split()))
grid = np.zeros((H + 2, W + 2), np.int32)
grid[1:-1, 1:-1] = (
    np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "."
) * 1
left = np.zeros((H + 2, W + 2), np.int32)
right = np.zeros((H + 2, W + 2), np.int32)
up = np.zeros((H + 2, W + 2), np.int32)
down = np.zeros((H + 2, W + 2), np.int32)
# 下方向に照らせるマスの数（自分の場所含む）
down[H] = grid[H]
for i in range(H, 0, -1):
    down[i - 1] = (down[i] + 1) * grid[i - 1]
up[1] = grid[1]
for i in range(1, H):
    up[i + 1] = (up[i] + 1) * grid[i + 1]
right[:, W] = grid[:, W]
for i in range(W, 0, -1):
    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1]
left[:, 1] = grid[:, 1]
for i in range(1, W):
    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1]
answer = (left + right + up + down - 3) * grid
print((np.max(answer)))

- -def main(): -    line = sys.stdin.readline -    H, W = list(map(int, line().split())) -    grid = np.zeros((H + 2, W + 2), np.int32) -    grid[1:-1, 1:-1] = ( -        np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "." -    ) * 1 -    left = np.zeros((H + 2, W + 2), np.int32) -    right = np.zeros((H + 2, W + 2), np.int32) -    up = np.zeros((H + 2, W + 2), np.int32) -    down = np.zeros((H + 2, W + 2), np.int32) -    # 下方向に照らせるマスの数（自分の場所含む） -    down[H] = grid[H] -    for i in range(H, 0, -1): -        down[i - 1] = (down[i] + 1) * grid[i - 1] -    up[1] = grid[1] -    for i in range(1, H): -        up[i + 1] = (up[i] + 1) * grid[i + 1] -    right[:, W] = grid[:, W] -    for i in range(W, 0, -1): -        right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1] -    left[:, 1] = grid[:, 1] -    for i in range(1, W): -        left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1] -    answer = (left + right + up + down) * grid -    print((np.max(answer) - 3)) - - -if __name__ == "__main__": -    main() +line = sys.stdin.readline +H, W = list(map(int, line().split())) +grid = np.zeros((H + 2, W + 2), np.int32) +grid[1:-1, 1:-1] = ( +    np.array([list(line().rstrip()) for _ in range(H)]).reshape(H, W) == "." +) * 1 +left = np.zeros((H + 2, W + 2), np.int32) +right = np.zeros((H + 2, W + 2), np.int32) +up = np.zeros((H + 2, W + 2), np.int32) +down = np.zeros((H + 2, W + 2), np.int32) +# 下方向に照らせるマスの数（自分の場所含む） +down[H] = grid[H] +for i in range(H, 0, -1): +    down[i - 1] = (down[i] + 1) * grid[i - 1] +up[1] = grid[1] +for i in range(1, H): +    up[i + 1] = (up[i] + 1) * grid[i + 1] +right[:, W] = grid[:, W] +for i in range(W, 0, -1): +    right[:, i - 1] = (right[:, i] + 1) * grid[:, i - 1] +left[:, 1] = grid[:, 1] +for i in range(1, W): +    left[:, i + 1] = (left[:, i] + 1) * grid[:, i + 1] +answer = (left + right + up + down - 3) * grid +print((np.max(answer)))