#!/usr/bin/env pypy3 import array import itertools def compute(height, width, is_sea): square_size = 0 dp = [array.array("L", (0 for _ in range(width + 2))) for _ in range(height + 2)] for r, c in itertools.product(range(1, height + 1), range(1, width + 1)): if not is_sea[r - 1][c - 1]: dp[r][c] = min(dp[r - 1][c - 1], dp[r - 1][c], dp[r][c - 1]) + 1 square_size = max(square_size, dp[r][c]) return (square_size + 1) // 2 def main(): height, width = map(int, input().split()) is_sea = [array.array("B", map(lambda x: x == ".", input())) for _ in range(height)] print(compute(height, width, is_sea)) if __name__ == '__main__': main()