언젠가는 펼쳐 볼 아카이브
[BOJ] 10798번 - 세로읽기 본문
사용언어 : javascript - node.js
#제출코드
const fs = require('fs');
const filePath = process.platform === 'linux' ? '/dev/stdin' : './input.txt';
const input = fs.readFileSync(filePath).toString().trim().split('\n');
solution(input);
function solution(input) {
let answer = '';
let map = {};
for (let i = 0; i < input.length; i++) {
let tempStr = input[i].trim();
for (let j = 0; j < tempStr.length; j++) {
if (!map.hasOwnProperty(j)) {
map[j] = tempStr.charAt(j);
} else {
map[j] += tempStr.charAt(j);
}
}
}
for (let key in map) {
answer += map[key];
}
console.log(answer);
}
'IT > Baekjoon Oline Judge' 카테고리의 다른 글
[BOJ] 2745번 - 진법 변환 (0) | 2023.08.25 |
---|---|
[BOJ] 2563번 - 색종이 (0) | 2023.08.23 |
[BOJ] 2566번 - 최댓값 (0) | 2023.08.23 |
[BOJ] 2738번 - 행렬 덧셈 (0) | 2023.08.22 |
[BOJ] 25206번 - 너의 평점은 (0) | 2023.08.22 |