-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCoverinWater.java
More file actions
34 lines (34 loc) · 853 Bytes
/
CoverinWater.java
File metadata and controls
34 lines (34 loc) · 853 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
import java.util.*;
public class CoverinWater {
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int t=sc.nextInt();
while(t--!=0)
{
int n=sc.nextInt();
String str=sc.next();
int ans=0;
int cnt=0;
int tot=0;
for(char ch:str.toCharArray())
{
if(ch=='.')
{
cnt++;
tot++;
ans=Math.max(ans,cnt);
}
else
{
cnt=0;
}
}
ans=Math.max(cnt,ans);
if(ans>2)
System.out.println("2");
else
System.out.println(tot);
}
sc.close();
}
}