in the grid that are not part of a blob are represented by periods (.). In the diagram below, there are 4 blobs shown in different colors.
....***.
..*....*
.***....
**.**...
.***..**
..**....
**..*..*
Blobs with colors: see image.
Write a program that will determine the number of cells in the blob given the coordinates of a character in the grid. The uppermost, leftmost character of the example above is in row 1, column 1 or location 1 1. Input will from a data file (blob.txt) and the first line of input will contain a single integer n that indicates the number of data sets to follow. For each data set:
The first line will contain three integers in the form r c s which meet the following criteria:
r >= 3 is the number of rows in the grid
c >= 3 is the number of columns in the grid
s > 1 is the number of test cases for that grid
The next r lines will contain the grid.
The next s lines will each contain an ordered pair x y, 1 <= x <= r and 1 <= y <= c, which is the location of a character in the grid.
For each test case, you will print the number of cells in the blob that contains the cell at the given location. If the test case falls on a square that is not part of a blob, print "NO BLOB". Let the user input the file name from the keyboard. Use user-defined functions/methods in your program. Do not use break or continue statements. Do not use recursion in this problem; otherwise, use any data structure of your choice. Refer to the sample output below.
Sample File:
1
7 8 2
....***.
..*....*
.***....
**.**...
.***..**
..**....
**..*..*
7 1
5 6
Sample Run:
Enter the filename: blob.txt
Location (7,1): Size 16 Blob.
Location (5,6): NO BLOB