IT/Baekjoon Oline Judge

[BOJ] 27866번 - 문자와 문자열

개발자희망생고롸파덕 2023. 8. 17. 19:38

사용언어: 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');

const idx = +input[1];

solution(input[0], idx);

function solution(str, index) {
  console.log(str.charAt(index - 1));
}