From a 2D array (matrix) containing only 1s(land) and null(water), count the number of islands in it. An island is a connected set of 1s(land) and is surrounded by either an edge or null(water). Each cell is considered connected to other cells horizontally or vertically (not diagonally).
Output ...
Write input with number separeted by commas, it will be transformed into an array so it can be calculated. Ex) 4,5,2,1,1.
Output ...