728x90
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Set;
public class GomGomE {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
Set<String> set = new HashSet<>();
int count = 0;
int N = Integer.parseInt(br.readLine());
for (int i = 0; i < N; i++) {
String s = br.readLine();
if (s.equals("ENTER")) {
set.clear();
} else {
if (!set.contains(s)) {
count++;
set.add(s);
}
}
}
System.out.println(count);
}
}
728x90
'백준' 카테고리의 다른 글
백준 2108 - Java (0) | 2024.09.12 |
---|---|
백준 26069 - Java (0) | 2024.09.12 |
백준 1037 - Java (0) | 2024.09.11 |
백준 11050 - Java (0) | 2024.09.09 |
백준 10872 - Java (0) | 2024.09.09 |