-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1900A.cpp
More file actions
41 lines (31 loc) · 825 Bytes
/
1900A.cpp
File metadata and controls
41 lines (31 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
string s;
cin >> s;
bool continuous_three_empty_cells = false;
int total_count_of_empty_cells = 0;
for (int i = 0; i < n; i++)
{
if (s[i] == '.' && i + 1 < n && s[i + 1] == '.' && i + 2 < n && s[i + 2] == '.')
{
continuous_three_empty_cells = true;
break;
}
if (s[i] == '.')
total_count_of_empty_cells++;
}
if (continuous_three_empty_cells)
cout << 2 << endl;
else
cout << total_count_of_empty_cells << endl;
}
return 0;
}