Given N * M field of
Return the number of black shapes. A black shape consists of one or more adjacent
X's (diagonals not included)
OOOXOOO OOXXOXO OXOOOXO answer is 3 shapes are : (i) X X X (ii) X (iii) X X
Note that we are looking for connected shapes here.
XXX XXX XXX
is just one single connected black shape.