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

[๋ฐฑ์ค€][Node.js] 10808๋ฒˆ : ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜

by ๐Ÿ‡๋ฐ•๋ด‰๋ด‰๐Ÿ‡ 2022. 2. 19.

 

 

Algorithm

-  ์•ŒํŒŒ๋ฒณ ๊ฐœ์ˆ˜ -

 


 

๋ฌธ์ œ

์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ๋‹จ์–ด S๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๊ฐ ์•ŒํŒŒ๋ฒณ์ด ๋‹จ์–ด์— ๋ช‡ ๊ฐœ๊ฐ€ ํฌํ•จ๋˜์–ด ์žˆ๋Š”์ง€ ๊ตฌํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

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

 

๋ฌธ์ œ ํ’€๊ธฐ

let fs = require("fs");
let input = fs.readFileSync("/dev/stdin").toString().trim().split("");
let str = "abcdefghijklmnopqrstuvwxyz";
let alpha = Array(26).fill(0);

for (let i = 0; i < input.length; i++) {
	alpha[str.indexOf(input[i])]++;
}

console.log(alpha.join(" "));

 

 

 

๋ฐ˜์‘ํ˜•

๋Œ“๊ธ€