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