나의 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
const str = require("fs")
.readFileSync(0)
.toString()
.trim()
.split("");
const alphabet = new Array(26);
alphabet.fill(-1);
str.forEach((s, idx) => {
if (alphabet[s.charCodeAt() - 97] === -1) {
alphabet[s.charCodeAt() - 97] = idx;
}
});
console.log(alphabet.join(" "));
|
cs |
'개발자 첫걸음 > 백준' 카테고리의 다른 글
백준 문자열 4 - 문자열 반복 [2675] (1) | 2022.10.05 |
---|---|
백준 [BOJ 1100] - 하얀 칸 (0) | 2022.10.04 |
백준 [BOJ 11720] - 숫자의 합 (0) | 2022.10.03 |
백준 [BOJ 11654] - 아스키 코드 (0) | 2022.10.03 |
백준 [BOJ 15596] 정수 N개의 합 (0) | 2022.09.30 |