Buggy python submission (verdict: Time Limit Exceeded):
"""h,w = map(int,input().split())
li = [[0 for _ in range(w)] for _ in range(h)]

for i in range(h):
    s = input()
    count = 0
    for j in range(w):
        if j != w-1:
            if s[j] == '.':
                count += 1
            else:
                li[i][j] = 0
                for k in range(count):
                    li[i][j-k-1] = count
                count = 0
        else:
            if s[j] == '.':
                count += 1
                for k in range(count):
                    li[i][j-k] = count
            else:
                li[i][j] = 0
                for k in range(count):
                    li[i][j-k-1] = count

for i in range(w):
    count = 0
    for j in range(h):
        if j != h-1:
            if li[j][i] > 0:
                count += 1
            else:
                for k in range(count):
                    li[j-k-1][i] += count
                count = 0
        else:
            if li[j][i] > 0:
                count += 1
                for k in range(count):
                    li[j-k][i] += count
            else:
                for k in range(count):
                    li[j-k-1][i] += count

ans = 0

for i in range(h):
    ans = max(ans,max(li[i]))

print(ans-1)

"""


h,w = map(int,input().split())
s = [input() for _ in range(h)]

l = [[0] * w for _ in range(h)]
r = [[0] * w for _ in range(h)]
u = [[0] * w for _ in range(h)]
d = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i][j] = 0
        else:
            if j == 0:
                l[i][j] = 1
            else:
                l[i][j] = l[i][j-1] + 1

for i in range(h):
    for j in range(w-1, -1, -1):
        if s[i][j] == '#':
            r[i][j] = 0
        else:
            if j == w-1:
                r[i][j] = 1
            else:
                r[i][j] = r[i][j+1] + 1

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            u[i][j] = 0
        else:
            if i == 0:
                u[i][j] = 1
            else:
                u[i][j] = u[i-1][j] + 1

for i in range(h-1, -1 ,-1):
    for j in range(w):
        if s[i][j] == '#':
            d[i][j] = 0
        else:
            if i == h-1:
                d[i][j] = 1
            else:
                d[i][j] = d[i+1][j] + 1

ans = 0

for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)

print(ans)


Fixed submission:
h,w = map(int,input().split())
s = [input() for _ in range(h)]

l = [[0] * w for _ in range(h)]
r = [[0] * w for _ in range(h)]
u = [[0] * w for _ in range(h)]
d = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i][j] = 0
        else:
            if j == 0:
                l[i][j] = 1
            else:
                l[i][j] = l[i][j-1] + 1

for i in range(h):
    for j in range(w-1, -1, -1):
        if s[i][j] == '#':
            r[i][j] = 0
        else:
            if j == w-1:
                r[i][j] = 1
            else:
                r[i][j] = r[i][j+1] + 1

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            u[i][j] = 0
        else:
            if i == 0:
                u[i][j] = 1
            else:
                u[i][j] = u[i-1][j] + 1

for i in range(h-1, -1 ,-1):
    for j in range(w):
        if s[i][j] == '#':
            d[i][j] = 0
        else:
            if i == h-1:
                d[i][j] = 1
            else:
                d[i][j] = d[i+1][j] + 1

ans = 0

for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
h,w = map(int,input().split())
li = [[0 for _ in range(w)] for _ in range(h)]

for i in range(h):
    s = input()
    count = 0
    for j in range(w):
        if j != w-1:
            if s[j] == '.':
                count += 1
            else:
                li[i][j] = 0
                for k in range(count):
                    li[i][j-k-1] = count
                count = 0
        else:
            if s[j] == '.':
                count += 1
                for k in range(count):
                    li[i][j-k] = count
            else:
                li[i][j] = 0
                for k in range(count):
                    li[i][j-k-1] = count

for i in range(w):
    count = 0
    for j in range(h):
        if j != h-1:
            if li[j][i] > 0:
                count += 1
            else:
                for k in range(count):
                    li[j-k-1][i] += count
                count = 0
        else:
            if li[j][i] > 0:
                count += 1
                for k in range(count):
                    li[j-k][i] += count
            else:
                for k in range(count):
                    li[j-k-1][i] += count

ans = 0

for i in range(h):
    ans = max(ans,max(li[i]))

print(ans-1)


Fixed submission:
h,w = map(int,input().split())
s = [input() for _ in range(h)]

l = [[0] * w for _ in range(h)]
r = [[0] * w for _ in range(h)]
u = [[0] * w for _ in range(h)]
d = [[0] * w for _ in range(h)]

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            l[i][j] = 0
        else:
            if j == 0:
                l[i][j] = 1
            else:
                l[i][j] = l[i][j-1] + 1

for i in range(h):
    for j in range(w-1, -1, -1):
        if s[i][j] == '#':
            r[i][j] = 0
        else:
            if j == w-1:
                r[i][j] = 1
            else:
                r[i][j] = r[i][j+1] + 1

for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            u[i][j] = 0
        else:
            if i == 0:
                u[i][j] = 1
            else:
                u[i][j] = u[i-1][j] + 1

for i in range(h-1, -1 ,-1):
    for j in range(w):
        if s[i][j] == '#':
            d[i][j] = 0
        else:
            if i == h-1:
                d[i][j] = 1
            else:
                d[i][j] = d[i+1][j] + 1

ans = 0

for i in range(h):
    for j in range(w):
        ans = max(ans, l[i][j] + r[i][j] + u[i][j] + d[i][j] - 3)

print(ans)