ll@h,@w,c,a=1e5;string@s[h];rep[s](i,h){c=0;rep[i](j,w){if(j=='.'&&c)a=min(a,c),c=0;if(j=='#')c++;}if(c)a=min(a,c);}rep(i,w){c=0;rep(j,h){if(s[j][i]=='.'&&c)a=min(a,c),c=0;if(s[j][i]=='#')c++;}if(c)a=min(a,c);}wt(a);