HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🤎
프론트엔드 데브코스 5기 교육생
/
🐥
김은수팀
/
🏆
7주차 : 기업 코테 딱대
/
3. 좋은 단어

3. 좋은 단어

URL
https://www.acmicpc.net/problem/3986
고른사람
송희
난이도
실버 4

다윤 풀이

const filePath = process.platform === "linux" ? "/dev/stdin" : "input.txt"; let [N, ...inputs] = require("fs") .readFileSync(filePath) .toString() .trim() .split("\n"); let answer = 0; inputs.forEach((input) => { const word = input.trim(); const stack = []; word.split("").forEach((w) => { const top = stack[stack.length - 1]; if (stack.length === 0 || top !== w) { stack.push(w); } else { stack.pop(); } }); if (stack.length == 0) answer++; }); console.log(answer);

민수 풀이

let [N,...arr] = require('fs').readFileSync("/dev/stdin").toString().trim().split("\n"); let cnt = 0; arr.forEach(e => { let value = e.trim(); let stack = []; for(let i = 0; i < value.length; i++){ stack[stack.length-1] === value[i] ? stack.pop() : stack.push(value[i]); } if(stack.length === 0) cnt += 1; }) console.log(cnt);

재현 풀이

송희 풀이

승민 풀이