H,W=map(int,input().split()) S=[list(input()) for i in range(H)] i=0 j=0 while i