LearnPy Hub
← Arena
IntermediateRating 1400

One Generation of Life

Apply one step of Conway's Game of Life to a grid of . (dead) and # (alive). Cells outside the grid are dead.

Input

r c, then r lines.

Output

r lines.

Sample 1

Input
3 3
.#.
.#.
.#.
Output
...
###
...

Sample 2

Input
4 4
....
.##.
.##.
....
Output
....
.##.
.##.
....
solution.py
Output appears here
One Generation of Life · Python Arena problem · LearnPy Hub