10946 - You want what filled?

Difficulty : easy

Solution Description :

Flood Fill problem

4-way flood fill, (i,j-1)->left, (i,j+1)->right, (i-1,j)->top, and (i+1,j)-> bottom 

Do a floodfill from every point in the grid that isn't a period, and keep a list of the holes you find and the characters associated with. Sort this list at the end as per the given criteria, and output it.