11238: ABC375 - A - Seats
[Creator : ]
Description
There are $N$ seats in a row, numbered $1, 2, \ldots, N$.
The state of the seats is given by a string $S$ of length $N$ consisting of #
and .
. If the $i$-th character of $S$ is #
, it means seat $i$ is occupied; if it is .
, seat $i$ is unoccupied.
Find the number of integers $i$ between $1$ and $N - 2$, inclusive, that satisfy the following condition:
- Seats $i$ and $i + 2$ are occupied, and seat $i + 1$ is unoccupied.
Input
The input is given from Standard Input in the following format:
$N$
$S$
Output
Print the answer.
Constraints
- $N$ is an integer satisfying $1 \leq N \leq 2 \times 10^5$.
- $S$ is a string of length $N$ consisting of
#
and.
.
Sample 1 Input
6
#.##.#
Sample 1 Output
2
$i = 1$ and $4$ satisfy the condition, so the answer is $2$.
Sample 2 Input
1
#
Sample 2 Output
0
Sample 3 Input
9
##.#.#.##
Sample 3 Output
3