#D11097. Fissure Puzzle Easy
Fissure Puzzle Easy
Fissure Puzzle Easy
Problem
There is a grid of cells. Initially all cells are white. Follow the steps below to increase the number of black squares.
Select one white cell from the cells that are even-numbered from the top and even-numbered from the left. The selected square turns black. Further, the adjacent white squares also change to black in a chain reaction in each of the vertical and horizontal directions of the squares. This chain continues until there are no white cells in that direction. (An example is shown below)
□□□□□□□□□ □□□□□□□□□ □□□□□□□□□ □□□□□□□□□ □□□□□□□□□ □□□□□□□□□ □□□□□□□□□ □□□□□□□□□ □□□□□□□□□ ↓ Select the 4th from the top and the 6th from the left □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ ■■■■■■■■■ □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ ↓ Select the second from the top and the second from the left □ ■ □□□ ■ □□□ ■■■■■■ □□□ □ ■ □□□ ■ □□□ ■■■■■■■■■ □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ □□□□□ ■ □□□ ↓ Select 6th from the top and 8th from the left □ ■ □□□ ■ □□□ ■■■■■■ □□□ □ ■ □□□ ■ □□□ ■■■■■■■■■ □□□□□ ■ □ ■ □ □□□□□ ■■■■ □□□□□ ■ □ ■ □ □□□□□ ■ □ ■ □ □□□□□ ■ □ ■ □
You want to create a grid where the color of the th cell from the top and the th cell from the left is . Find the minimum number of times to select a square.
Constraints
The input satisfies the following conditions.
- is odd
- is'o'or'x'
- Only input that can be made is given
Input
The input is given in the following format.
... ... ... ...
When is'o', it means that the th cell from the top and the th cell from the left are white, and when it is'x', it is a black cell. Represents that.
Output
Outputs the minimum number of times to select a cell on the first line.
Examples
Input
5 oxooo oxooo oxooo xxxxx oxooo
Output
1
Input
9 oxoooooxo oxxxxxxxx oxoooooxo xxxxxxxxx oxoxooooo oxxxxxxxx oxoxoxooo oxoxxxxxx oxoxoxooo
Output
4
inputFormat
input satisfies the following conditions.
- is odd
- is'o'or'x'
- Only input that can be made is given
Input
The input is given in the following format.
... ... ... ...
When is'o', it means that the th cell from the top and the th cell from the left are white, and when it is'x', it is a black cell. Represents that.
outputFormat
Output
Outputs the minimum number of times to select a cell on the first line.
Examples
Input
5 oxooo oxooo oxooo xxxxx oxooo
Output
1
Input
9 oxoooooxo oxxxxxxxx oxoooooxo xxxxxxxxx oxoxooooo oxxxxxxxx oxoxoxooo oxoxxxxxx oxoxoxooo
Output
4
样例
5
oxooo
oxooo
oxooo
xxxxx
oxooo
1