largest-basin-size

Find the largest basin size in a given matrix.               
       9 9 9 8 8 8     
       8 8 8 7 7 7       
       7 7 7 7 7 7 
       8 8 8 8 9 9         
       5 5 5 5 6 3       
       5 5 5 3 3 3       
For the above example, the Bold values form the maximum size basin. Answer for above case is: 9

INPUT
First line of the input contains N( Number of rows ) and M( Number of columns) separated by a space. 
The next N lines contain M space separated elements representing the array. See sample input output for more clarity 

OUTPUT
Print the size of the maximum size basin.

SAMPLE INPUT
6 6
9 9 9 8 8 8
8 8 8 7 7 7
7 7 7 7 7 7
8 8 8 8 9 9
5 5 5 5 6 3
5 5 5 3 3 3

SAMPLE OUTPUT
9

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions: