label 0,1;var\x0d a,x:array[0..15]of string;i,j,s:word;begin\x0d a[15]:='##########';for i:=0to 14do\x0d begin ReadLn(a[i]);x[i]:=' 'end;for i:=0to 3do for j:=1to 10do\x0d if'#'=a[i][j]then\x0d begin a[i][j]:=' ';x[i][j]:='#'end;s:=0;repeat\x0d for i:=0to 3do\x0d for j:=1to 10do\x0d if(a[i+s+1][j]='#')and(x[i][j]='#')then goto 0;Inc(s);until\x0d 0=1;0:for i:=0to 14do\x0d for j:=1to 10do\x0d if'#'=x[i][j]then a[i+s][j]:='#';for\x0d i:=0to 14do\x0d begin\x0d for j:=1to 10do if' '=a[i][j]then goto 1;for\x0d j:=i downto 1do a[j]:=a[j-1];1:end;\x0d for i:=0to 14do WriteLn(a[i])end.
Note that non-ascii characters in the above source code will be escaped (such as \x9f).