Surrounded Regions

Capture all regions of 'O' that are completely surrounded by 'X'. An 'O' region survives when it touches the border or connects to a border 'O' through up, down, left, or right neighbours. Return the resulting board; the returned rows are what the checker compares.

Examples
Input: ["XXXX","XOOX","XXOX","XOXX"]
Output: ["XXXX","XXXX","XXXX","XOXX"]
Hints

Surrounded Regions

Capture all regions of `'O'` that are completely surrounded by `'X'`. An `'O'` region survives when it touches the border or connects to a border `'O'` through up, down, left, or right neighbours. Return the resulting board; the returned rows are what the checker compares.