import sys
from itertools import groupby

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def len_count(S):
    H, W = len(S), len(S[0])
    L = [[0] * W for _ in range(H)]
    for row_S, row_L in zip(S, L):
        vec = [1]
        for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = row_S[0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

    return L


def main():
    H, W = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    L1 = [[0] * W for _ in range(H)]
    for x in range(H):
        vec = [1]
        for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[x][0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

    L2 = [[0] * W for _ in range(H)]
    for y in range(W):
        vec = [1]
        for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[0][y] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

    ans = 0
    for i in range(H):
        for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

    print(ans)
    return


if __name__ == '__main__':
    main() import sys sys from itertools import groupby read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read readline = sys.stdin.readline readline sys.stdin.readline sys.stdin sys stdin readline readlines = sys.stdin.readlines readlines sys.stdin.readlines sys.stdin sys stdin readlines sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 1 << 60 INF 1 << 60 1 60 def len_count(S):
    H, W = len(S), len(S[0])
    L = [[0] * W for _ in range(H)]
    for row_S, row_L in zip(S, L):
        vec = [1]
        for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = row_S[0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

    return L len_count H, W = len(S), len(S[0]) H len(S) len S W len(S[0]) len S[0] S 0 [0] * W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0] * W [0] 0 W L = [[0] * W for _ in range(H)] L [[0] * W for _ in range(H)] for row_S, row_L in zip(S, L):
        vec = [1]
        for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = row_S[0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

     row_S row_L zip(S, L) zip S L vec = [1] vec [1] 1 for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

         i range(1, W) range 1 W if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

         row_S[i - 1] == row_S[i] row_S[i - 1] row_S i - 1 i 1 row_S[i] row_S i vec[-1] += 1 vec[-1] vec -1 1 vec.append(1) vec.append vec append 1 idx = 0 idx 0 valid = row_S[0] == '.' valid row_S[0] == '.' row_S[0] row_S 0 '.' for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

     n vec if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
             valid for i in range(idx, idx + n):
                    row_L[i] = n
             i range(idx, idx + n) range idx idx + n idx n row_L[i] = n row_L[i] row_L i n idx += n idx n valid = not valid valid not valid valid return L L S S def main():
    H, W = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    L1 = [[0] * W for _ in range(H)]
    for x in range(H):
        vec = [1]
        for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[x][0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

    L2 = [[0] * W for _ in range(H)]
    for y in range(W):
        vec = [1]
        for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[0][y] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

    ans = 0
    for i in range(H):
        for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

    print(ans)
    return main H, W = map(int, readline().split()) H map(int, readline().split()) map int readline().split() ().split () readline split W readline().strip() for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) readline().strip() ().strip () readline strip S = [readline().strip() for _ in range(H)] S [readline().strip() for _ in range(H)] [0] * W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0] * W [0] 0 W L1 = [[0] * W for _ in range(H)] L1 [[0] * W for _ in range(H)] for x in range(H):
        vec = [1]
        for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[x][0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

     x range(H) range H vec = [1] vec [1] 1 for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

         i range(1, W) range 1 W if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

         S[x][i - 1] == S[x][i] S[x][i - 1] [x] S x i - 1 i 1 S[x][i] [x] S x i vec[-1] += 1 vec[-1] vec -1 1 vec.append(1) vec.append vec append 1 idx = 0 idx 0 valid = S[x][0] == '.' valid S[x][0] == '.' S[x][0] [x] S x 0 '.' for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

     n vec if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
             valid for i in range(idx, idx + n):
                    L1[x][i] = n
             i range(idx, idx + n) range idx idx + n idx n L1[x][i] = n L1[x][i] [x] L1 x i n idx += n idx n valid = not valid valid not valid valid [0] * W for _ in range(H) for _ in range(H) _ range(H) range H for _ in range(H) [0] * W [0] 0 W L2 = [[0] * W for _ in range(H)] L2 [[0] * W for _ in range(H)] for y in range(W):
        vec = [1]
        for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[0][y] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

     y range(W) range W vec = [1] vec [1] 1 for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

         i range(1, H) range 1 H if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

         S[i - 1][y] == S[i][y] S[i - 1][y] [i - 1] S i - 1 i 1 y S[i][y] [i] S i y vec[-1] += 1 vec[-1] vec -1 1 vec.append(1) vec.append vec append 1 idx = 0 idx 0 valid = S[0][y] == '.' valid S[0][y] == '.' S[0][y] [0] S 0 y '.' for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

     n vec if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
             valid for i in range(idx, idx + n):
                    L2[i][y] = n
             i range(idx, idx + n) range idx idx + n idx n L2[i][y] = n L2[i][y] [i] L2 i y n idx += n idx n valid = not valid valid not valid valid ans = 0 ans 0 for i in range(H):
        for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

     i range(H) range H for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

     j range(W) range W if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

     ans < L1[i][j] + L2[i][j] - 1 ans L1[i][j] + L2[i][j] - 1 L1[i][j] + L2[i][j] L1[i][j] [i] L1 i j L2[i][j] [i] L2 i j 1 ans = L1[i][j] + L2[i][j] - 1 ans L1[i][j] + L2[i][j] - 1 L1[i][j] + L2[i][j] L1[i][j] [i] L1 i j L2[i][j] [i] L2 i j 1 print(ans) print ans return if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main readline = sys.stdin.readline sys.stdin.readline readline def main():
    H, W = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    L1 = [[0] * W for _ in range(H)]
    for x in range(H):
        vec = [1]
        for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[x][0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

    L2 = [[0] * W for _ in range(H)]
    for y in range(W):
        vec = [1]
        for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[0][y] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

    ans = 0
    for i in range(H):
        for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

    print(ans)
    return def main():
    H, W = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    L1 = [[0] * W for _ in range(H)]
    for x in range(H):
        vec = [1]
        for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[x][0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

    L2 = [[0] * W for _ in range(H)]
    for y in range(W):
        vec = [1]
        for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[0][y] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

    ans = 0
    for i in range(H):
        for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

    print(ans)
    return main INF = 1 << 60 1 << 60 INF read = sys.stdin.read sys.stdin.read read readlines = sys.stdin.readlines sys.stdin.readlines readlines def len_count(S):
    H, W = len(S), len(S[0])
    L = [[0] * W for _ in range(H)]
    for row_S, row_L in zip(S, L):
        vec = [1]
        for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = row_S[0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

    return L def len_count(S):
    H, W = len(S), len(S[0])
    L = [[0] * W for _ in range(H)]
    for row_S, row_L in zip(S, L):
        vec = [1]
        for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = row_S[0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

    return L len_count
import sys
from itertools import groupby

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60


def len_count(S):
    H, W = len(S), len(S[0])
    L = [[0] * W for _ in range(H)]
    for row_S, row_L in zip(S, L):
        vec = [1]
        for i in range(1, W):
            if row_S[i - 1] == row_S[i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = row_S[0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    row_L[i] = n
            idx += n
            valid = not valid

    return L


def main():
    H, W = map(int, readline().split())
    S = [readline().strip() for _ in range(H)]

    L1 = [[0] * W for _ in range(H)]
    for x in range(H):
        vec = [1]
        for i in range(1, W):
            if S[x][i - 1] == S[x][i]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[x][0] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L1[x][i] = n
            idx += n
            valid = not valid

    L2 = [[0] * W for _ in range(H)]
    for y in range(W):
        vec = [1]
        for i in range(1, H):
            if S[i - 1][y] == S[i][y]:
                vec[-1] += 1
            else:
                vec.append(1)

        idx = 0
        valid = S[0][y] == '.'
        for n in vec:
            if valid:
                for i in range(idx, idx + n):
                    L2[i][y] = n
            idx += n
            valid = not valid

    ans = 0
    for i in range(H):
        for j in range(W):
            if ans < L1[i][j] + L2[i][j] - 1:
                ans = L1[i][j] + L2[i][j] - 1

    print(ans)
    return


if __name__ == '__main__':
    main()
