import sys h,w=map(int,raw_input().split()) S=[[1-ord(c)/46 for c in e.strip()] for e in sys.stdin] for y in range(1,h): for x in range(1,w):S[y][x]+=min(S[y-1][x-1],S[y][x-1],S[y-1][x])*S[y][x] S[y]=max(S[y]) print -~max(S)/2