Problem I
Oooh I See
Captain O’Capten has hidden some treasure and created a map
to mark where it is buried. Rather than using ‘X’ to mark the
spot, he has decided to obfuscate the location by using a grid
of uppercase O (the letter O) characters and 0
(the number 0) characters. The
treasure’s position is given by the location of a 0 character surrounded on all sides by
Captain O’Capten wants to recover the location of his treasure but he is finding his map hard to read (huh, go figure). Help Captain O’Capten find the location of his treasure, or exclaim Oh no! if such a location is not marked on the map or there is more than one such location.
Input
The first line contains two integers
Output
If there is no 0 character
surrounded on all sides by
Sample Input 1 | Sample Output 1 |
---|---|
3 6 OO0OOO 00OO0O 0O0OOO |
2 5 |
Sample Input 2 | Sample Output 2 |
---|---|
5 3 OOO O0O OOO O0O OOO |
Oh no! 2 locations |
Sample Input 3 | Sample Output 3 |
---|---|
4 4 OOO0 0O0O OOO0 0O0O |
Oh no! |