You are given a 2D array with
Copy
function(grid):
for each row in the grid going from top to bottom:
for each column in the grid going from left to right:
if the character in the given row and given column is an 'o' and the character in the same column and one row lower is a '.':
swap those two characters in the grid
Print out the grid after running the procedure 100 times.
Constraints
In the array, the only characters that will appear are o
, #
, and .
.
Input Specification
The first line contains two space-separated integers,
Each of the next
Output Specification
Print the grid in exactly the same format after 100 simulations of the above procedure.
Sample Input
Copy
3 3
ooo
#..
..#
Sample Output
Copy
o..
#.o
.o#
Comments