import os m=os.read(0,1e5) w=m.find('\n')+1 t=(w,1,-w,-1) s=zip([m.find('.')]*4,t) while s: x,d=s.pop() while'#'!=m[x+d]:x+=d;s+=zip([x]*4*(m[x+d]=='#'>m[x]),t);m=m[:x]+'.'+m[x+1:] print m