-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoj1316.java
More file actions
38 lines (36 loc) · 934 Bytes
/
Boj1316.java
File metadata and controls
38 lines (36 loc) · 934 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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
public class Boj1316 {
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int N = Integer.parseInt(br.readLine());
int[] check = new int[26];
int cnt = 0;
for(int i=0; i<N;i++) {
String word = br.readLine();
for(int j=0; j<word.length()-1;j++) {
if(word.charAt(j)==word.charAt(j+1)) {
// continue;
}else {
check[word.charAt(j)-'a']++;
}
if(j== word.length()-2) {
check[word.charAt(j+1)-'a']++;
}
}
// System.out.println(Arrays.toString(check));
for(int j=0; j<check.length;j++) {
if(check[j]>1) {
cnt++;
break;
}
}
for(int j=0; j<check.length;j++) {
check[j]=0;
}
}
System.out.println(N-cnt);
}//main
}//class