https://www.acmicpc.net/problem/1316
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().split("\n");
const N = Number(input[0]);
let answer = 0;
for(let i = 0 ; i < N ; i++) {
let cnt = 0;
let view = [];
const tmp = input[i+1].split("");
let prev = '';
tmp.forEach((t, index) => {
if(index === 0) prev = t;
if(prev !== t && !view.includes(t)) {
view.push(prev);
prev = t;
}
if(view.includes(t)) {
cnt++;
}
});
if(cnt > 0) answer++;
}
console.log(N-answer);
728x90
'Algorithm\CodingTest > Baekjoon' 카테고리의 다른 글
[Baekjoon] [2744] 대소문자 바꾸기 (0) | 2023.02.10 |
---|---|
[Baekjoon] [2750] 수 정렬하기 (0) | 2023.02.09 |
[Baekjoon] [10773] 제로 (0) | 2023.02.09 |
[Baekjoon] [1157] 단어 공부 (0) | 2023.02.09 |
[Baekjoon] [4344] 평균은 넘겠지 (0) | 2023.02.09 |