-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileName.java
More file actions
33 lines (28 loc) · 897 Bytes
/
FileName.java
File metadata and controls
33 lines (28 loc) · 897 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
/**
* Created by MalhotR1 on 05/13/2018.
*/
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class FileName {
public static void main(String[] args) throws IOException {
try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
int N = Integer.parseInt(br.readLine().trim());
char[] in = br.readLine().trim().toCharArray();
int i = 0;
int total = 0;
while (i < in.length) {
if (in[i] == 'x') {
int j = i+1;
while (j < in.length && in[j] == 'x') j++;
if (j - i > 2) total += j - i - 2;
i = j;
}
else {
i++;
}
}
System.out.println(total);
}
}
}