개발 공부/Algorithm
[백준/Node.js] 팬그램
whenever purple
2023. 3. 20. 17:15
문제
팬그램은 알파벳의 모든 글자들을 사용해서 만든 문장이다. "the quick brown fox jumps over a lazy dog"과 "jackdaws loves my big sphinx of quartz"은 팬그램이다. 문장이 주어졌을 때, 팬그램인지 아닌지를 알아내는 프로그램을 작성하시오.
입출력 예시

해결
const fs = require('fs');
const { start } = require('repl');
const stdin = (process.platform === 'linux'
? fs.readFileSync('/dev/stdin').toString()
: `jackdawf loves my big quartz sphinx
abcdefghijklmnopqrstuvwxyz
hello world
*`
).match(/[^\r\n]+/g);
const input = (() => {
let line = 0;
return () => stdin[line++];
})();
let answer = [];
while (true) {
const str = input().replace(/ /g,'').split('')
if (str == '*') break;
let temp = [];
str.map((e) => {
if (!temp.includes(e)){
temp.push(e)
}
})
const result = temp.length == 26? 'Y' : 'N'
answer.push(result)
}
console.log(answer.join('\n'))