364. Flood Fill On Image
Given an m x n integer grid image, where each element image[i][j] represents the pixel value of the image, perform a flood fill on the image starting from the pixel image[sr][sc]. A flood fill involves changing the color of the starting pixel and any connected pixels of the same color in the 4-directional vicinity, and repeating this process for any newly connected pixels. Replace the color of all the affected pixels with the newColor. Print the modified image after performing the flood fill.
The first line of input will contain two integers n and m. The next n lines will each contain m space-separated integers representing the elements of the image grid. The third line will contain three integers sr, sc, and newColor.
Print the modified image after performing the flood fill.
3 3 1 1 1 1 1 0 1 0 1 1 1 2
2 2 2 2 2 0 2 0 1
N and M are both less than or equal to 50