HT Chen gives you a map sized m ✕ n consists of only two symbols '~' and'.', representing water and land, respectively. He wonders how many ponds (consecutive position of water) are there on the map. He has a thought that if he can write a recursive function, the problem may be very easy to solve!
The first line contains two integer m, n, representing the size of the map Frank gives to you.
The next m lines contain n characters, either '~' or '.', representing the status of position aij.
It is guaranteed that :
Please output the number of ponds on the map.