Bacteria Colony

View as PDF

Submit solution

Points: 7
Time limit: 2.0s
Memory limit: 64M

Author:
Problem types

Bacteria multiplies and grows into sizeable colonies very quickly if left alone under the right circumstances. A specific bacteria in a petri dish is observed under a microscope. The bacteria here is considered to be part of the same colony if they are connected by bacteria either directly above, below, to the left or to the right of it. Can you find the size of the colonies this bacteria created?

Input

The first line of input contains r 1 \le r \le 100 representing the number of rows that bacteria can grow to in the petri dish.
The second line of input contains c 1 \le c \le 100 representing the number of columns that bacteria can grow to in the petri dish.
The next r lines contains c characters, either a * or a _. If it is a *, there is bacteria there.

Output

For each individual colony, output the zero indexed location of the top left most bacteria. If the left most bacteria is not the upper most bacteria, use the upper most bacteria.
Also output the number of bacteria in the colony.
Output this in the format (row, column) size.

Sample Input

7
9
_________
___*__*__
__***_**_
***___*__
**_**____
___****__
___*__*__

Sample Output

(1, 3) 9
(1, 6) 4
(4, 3) 8

Comments

There are no comments at the moment.