본문 바로가기
개인공부/Algorithm

[백준][Node.js] 2743번 : 단어 길이 재기

by 🍇박봉봉🍇 2021. 9. 14.

 

 

Algorithm

-  단어 길이 재기 -

 


 

문제

알파벳으로만 이루어진 단어를 입력받아, 그 길이를 출력하는 프로그램을 작성하시오.

 

입출력 예시

 

문제 풀기

const readline = require("readline");
const rl = readline.createInterface({
	input: process.stdin,
	output: process.stdout,
});
let input;
rl.on("line", function (line) {
	input = line
		.toString()
		.trim();
}).on("close", function () {
	console.log(input.length);
	process.exit();
});

 

 

 

반응형

댓글