Programming/Algorithm
[백준]1315번 그룹 단어 체커 with Node.js
kort
2022. 7. 3. 19:01
const input = require("fs").readFileSync("/dev/stdin").toString().split("\n");
let result = 0;
for(let i=1; i<=input[0];i++){
const word = input[i]
const arr = [];
let grouping = true;
for(let j=0;j<word.length;j++){
if (arr.indexOf(word[j]) === -1) {
arr.push(word[j]);
} else {
if (arr.indexOf(word[j]) !== arr.length - 1) {
grouping = false;
break;
};
};
};
if(grouping) {
result++;
};
};
console.log(result);