Give an n by m matrix with positive numbers,
If there are three or more adjacent numbers
with the same value at the same row/col,
mark the number as 0.
Examples
{1, 2, 1}, {1, 0, 1},
{3, 2, 3}, -> {3, 0, 3},
{1, 2, 1}, {1, 0, 1},
{1, 3, 1, 1}, -> {1, 3, 1, 1},
{2, 2, 2, 2}, {0, 0, 0, 0},
{2, 2, 2, 3}, {0, 0, 0, 3},
{1, 2, 2, 1}, -> {1, 0, 2, 1},
{1, 2, 3, 1}, {1, 0, 3, 1},
{3, 3, 1, 1},
{1, 3, 3, 1}, no change
{1, 1, 3, 3},