-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path49882429.java
More file actions
37 lines (30 loc) · 931 Bytes
/
Copy path49882429.java
File metadata and controls
37 lines (30 loc) · 931 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
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int N = Integer.parseInt(br.readLine());
int cnt = 0;
OUTER:
for(int i = 0; i < N; i++) {
boolean[] check = new boolean[26];
String target = br.readLine();
int prev = 0;
for(int j = 0; j < target.length(); j++) {
if(prev != target.charAt(j)) {
if(check[target.charAt(j) - 'a'] == false) {
check[target.charAt(j) - 'a'] = true;
prev = target.charAt(j);
}
else {continue OUTER;}
}
}
cnt++;
}
System.out.println(cnt);
}
}