카테고리 없음

[Programmers/Level 0] 문자열 출력하기(JS)

dmscks3126 2025. 3. 14. 13:03

 

문제 링크

https://school.programmers.co.kr/learn/courses/30/lessons/181952

 

프로그래머스

SW개발자를 위한 평가, 교육, 채용까지 Total Solution을 제공하는 개발자 성장을 위한 베이스캠프

programmers.co.kr

 

 

문제

문자열 str이 주어질 때, str을 출력하는 코드를 작성해 보세요.

 

 

제한사항

  • 1 ≤ str의 길이 ≤ 1,000,000
  • str에는 공백이 없으며, 첫째 줄에 한 줄로만 주어집니다

 

예제 입력 1

HelloWorld!

 

예제 출력 1

HelloWorld!

 

 

코드

const readline = require('readline');
const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

let input = [];

rl.on('line', function (line) {
    input = [line];
}).on('close',function(){
    str = input[0];
    console.log(str)
});