#hhkb2020b. [hhkb2020_b]Futon
[hhkb2020_b]Futon
Problem Statement
We have a grid with horizontal rows and vertical columns of squares, where each square is tidy or untidy.
You will now place a mattress on this grid.
The mattress can be placed on two horizontally or vertically adjacent tidy squares in the grid.
Given are integers , , and strings of length each. If the -th character of is .
, the square at the -th row from the top and the -th column from the left is tidy; if the -th character of is #
, the square at the -th row from the top and the -th column from the left is untidy.
Find the number of ways to choose the position for the mattress.
Constraints
- is a string of length consisting of
.
and#
.
Input
Input is given from Standard Input in the following format:
Output
Print the number of ways to choose the position for the mattress.
Sample Input 1
2 3
..#
#..
Sample Output 1
3
We have the following three choices:
- the -st and -nd squares from the left in the -st row from the top;
- the -nd and -rd squares from the left in the -nd row from the top; and
- the -st and -nd squares from the top in the -nd column the left.
Sample Input 2
2 2
.#
#.
Sample Output 2
0