Emulating paint fill is easy and can be done either iteratively or thru stacks. This demonstration is done using plain text, but the same idea could be implemented using your favorite graphics framework.
First, we're given a two-dimensional array of canvass of type char with size [N][M], where N is the number of rows and M is the number of columns.
Let's suppose N = 11 and M = 15, but of course, the values of these two may vary.