Given a board of 0 (dead) and 1 (alive) cells, compute the next generation using Conway's rules: a live cell with 2 or 3 live neighbors survives; a dead cell with exactly 3 live neighbors becomes alive; all others die/stay dead. Neighbors are the 8 surrounding cells; cells outside the board don't exist (no wraparound).
Input:
- Line 1:
rows cols
- Next
rows lines: a string of 0/1 of length cols
Output: the next generation, rows lines of 0/1 strings.