1.문제
2.코드
import java.io.*;
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 result = 0;
out : while(N-->0) {
StringBuilder word = new StringBuilder(br.readLine());
boolean[] check = new boolean[27];
int curr = 0;
while(curr<word.length()){
if(check[word.charAt(curr)-'a']) {
continue out ;
}
check[word.charAt(curr)-'a']=true;
char curchar = word.charAt(curr);
while(curr<word.length() && word.charAt(curr)==curchar){
curr ++;
}
}
result ++;
}
System.out.println(result);
}
}
Review