๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
๊ฐœ์ธ๊ณต๋ถ€/Algorithm

[๋ฐฑ์ค€][Node.js] 10820๋ฒˆ : ๋ฌธ์ž์—ด ๋ถ„์„

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2022. 3. 7.

 

 

Algorithm

-  ๋ฌธ์ž์—ด ๋ถ„์„ -

 


 

๋ฌธ์ œ

๋ฌธ์ž์—ด N๊ฐœ๊ฐ€ ์ฃผ์–ด์ง„๋‹ค.

์ด๋•Œ, ๋ฌธ์ž์—ด์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” ์†Œ๋ฌธ์ž, ๋Œ€๋ฌธ์ž, ์ˆซ์ž, ๊ณต๋ฐฑ์˜ ๊ฐœ์ˆ˜๋ฅผ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

๊ฐ ๋ฌธ์ž์—ด์€ ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž, ๋Œ€๋ฌธ์ž, ์ˆซ์ž, ๊ณต๋ฐฑ์œผ๋กœ๋งŒ ์ด๋ฃจ์–ด์ ธ ์žˆ๋‹ค.

 

์ž…์ถœ๋ ฅ ์˜ˆ์‹œ

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin")
		.toString()
		.split("\n");

let zero = input.filter((el) => el.length < 1);

if (zero) input.splice(input.indexOf(zero[0]), 1);

for (let i = 0; i < input.length; i++) {
	let lower = input[i].length - input[i].replace(/[a-z]/g, "").length;
	let upper = input[i].length - input[i].replace(/[A-Z]/g, "").length;
	let number = input[i].length - input[i].replace(/[0-9]/g, "").length;
	let blank = input[i].length - input[i].replace(/\ /g, "").length;

	console.log(lower, upper, number, blank);
}

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€