t | battlefield = [input()] | t | """ |
| | | ------------ |
| | | .###.....#.. |
| | | .###.##..#.. |
| | | .....##..... |
| | | .....##..#.. |
| | | ............ |
| | | ............ |
| | | .####..####. |
| | | .......####. |
| | | .......####. |
| | | ------------ |
| | | """ |
| | | area = [input()] |
| battlefield.append(input()) | | area.append(input()) |
| while battlefield[-1][0] != '-': | | while area[-1][0] != '-': |
| battlefield.append(input()) | | area.append(input()) |
| row = len(battlefield) | | r = len(area) |
| col = len(battlefield[0]) | | c = len(area[0]) |
| number_of_ships = 0 | | square = 0 |
| for i in range(1, row - 1): | | for i in range(1, r - 1): |
| for j in range(1, col - 1): | | for j in range(1, c - 1): |
| if battlefield[i][j] == '#' and battlefield[i - 1][j] != '#' and (battlefield[i][j - 1] != '#'): | | if area[i][j] == '#' and area[i - 1][j] != '#' and (area[i][j - 1] != '#'): |
| number_of_ships += 1 | | square += 1 |
| print(number_of_ships) | | print(square) |