There are N seats in a row, numbered 1, 2, …, N.
The state of the seats is given by a string S of length N consisting of # and .. If the ith 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 condition that seats i and i+2 are occupied, and seat i+1 is unoccupied.
1 ≤ N ≤ 2 × 105
S is a string of length N consisting solely of # and ..
The input consists of two lines.
On the first line, there will be a single integer N
On the second line, there will be the string S
Output a single integer, representing the number of integers i between 1 and N-2, inclusive, that satisfy the condition that seats i and i+2 are occupied, and seat i+1 is unoccupied.
Subtask 1 (100%): No further constraints.
Subtask 2 (0%): Sample Testcases
6 #.##.#
2
i = 1 and 4 both satisfy the condition.
1 #
0
9 ##.#.#.##
3
Subtask | Score |
---|---|
1 | 100 |
2 | 0 |