import sys h,w=map(int,raw_input().split());r=0 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];r=max(r,S[y][x]) print -~r/2