-
Notifications
You must be signed in to change notification settings - Fork 1
/
p1316.java
27 lines (27 loc) · 882 Bytes
/
p1316.java
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
import java.io.*;
import java.util.*;
public class p1316 {
static int n;
static List<Character> list;
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
n = Integer.parseInt(br.readLine());
int cnt = n;
for (int i = 0; i < n; i++) {
String input = br.readLine();
char[] cArr = input.toCharArray();
list = new ArrayList<>();
for (int j = 0; j < cArr.length; j++) {
if (j == 0) continue;
if (cArr[j] != cArr[j - 1]) {
list.add(cArr[j - 1]);
if (list.contains(cArr[j])) {
cnt--;
break;
}
}
}
}
System.out.println(cnt);
}
}