[Node.js/JavaScript] ๋ฐฑ์ค€ 10809๋ฒˆ ์•ŒํŒŒ๋ฒณ ์ฐพ๊ธฐ
ยท
Algorithm/๋ฐฑ์ค€(BOJ)
๋ฌธ์ œ ์•ŒํŒŒ๋ฒณ ์†Œ๋ฌธ์ž๋กœ๋งŒ ์ด๋ฃจ์–ด์ง„ ๋‹จ์–ด S๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ๊ฐ๊ฐ์˜ ์•ŒํŒŒ๋ฒณ์— ๋Œ€ํ•ด์„œ, ๋‹จ์–ด์— ํฌํ•จ๋˜์–ด ์žˆ๋Š” ๊ฒฝ์šฐ์—๋Š” ์ฒ˜์Œ ๋“ฑ์žฅํ•˜๋Š” ์œ„์น˜๋ฅผ, ํฌํ•จ๋˜์–ด ์žˆ์ง€ ์•Š์€ ๊ฒฝ์šฐ์—๋Š” -1์„ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค. ํ’€์ด const input = require('fs').readFileSync('์˜ˆ์ œ.txt').toString().trim().split(''); let result = ''; // UTF-16 ์ฝ”๋“œ ์œ ๋‹›์˜ ์‹œํ€€์Šค๋กœ๋ถ€ํ„ฐ a - z ๋ฌธ์ž๋ฅผ ์ƒ์„ฑํ•œ ํ›„ ํ•ด๋‹น ๋ฌธ์ž์˜ ์ธ๋ฑ์Šค๋ฅผ ๋ฐ˜ํ™˜ // ํ•ด๋‹น ๋ฌธ์ž๊ฐ€ ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด -1์„ ๋ฐ˜ํ™˜ for (let i = 97; i
_์„ฑํ˜ธ_
'๋ฐฑ์ค€ 10809๋ฒˆ ์•ŒํŒŒ๋ฒณ ์ฐพ๊ธฐ' ํƒœ๊ทธ์˜ ๊ธ€ ๋ชฉ๋ก