[203] 2743번 단어 길이 재기

younoah·2021년 11월 13일
0

[백준-기초]

목록 보기
16/29

2743번 단어 길이 재기

문제

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

입력

첫째 줄에 영어 소문자와 대문자로만 이루어진 단어가 주어진다. 단어의 길이는 최대 100이다.

출력

첫째 줄에 입력으로 주어진 단어의 길이를 출력한다.

예제 입력 1 복사

pulljima

예제 출력 1 복사

8

코드

//---- 세팅 ----//
const fs = require('fs');
const stdin = (
  process.platform === 'linux'
    ? fs.readFileSync('/dev/stdin').toString()
    : `\
pulljima
`
).split('\n');

const input = (() => {
  let line = 0;
  return () => stdin[line++];
})();

//---- 풀이 -----//
const str = input();

console.log(str.length);

풀이

입력받은 단어의 길이를 출력한다.

profile
console.log(noah(🍕 , 🍺)); // true

0개의 댓글