티스토리 뷰
https://www.acmicpc.net/problem/2744
2744번: 대소문자 바꾸기
영어 소문자와 대문자로 이루어진 단어를 입력받은 뒤, 대문자는 소문자로, 소문자는 대문자로 바꾸어 출력하는 프로그램을 작성하시오.
www.acmicpc.net
const input = require('fs').readFileSync('./dev/stdin').toString().trim();
let answer = '';
for (let i = 0; i < input.length; i++) {
const code = input[i].charCodeAt(0);
if (code >= 65 && code <= 90) {
answer += String.fromCharCode(code + 32);
} else {
answer += String.fromCharCode(code - 32);
}
}
console.log(answer);
728x90
'자료구조 알고리즘 > 백준' 카테고리의 다른 글
Node.js) 백준 10826번: 피보나치 수 4 (0) | 2023.08.12 |
---|---|
Node.js) 백준 9625번: BABBA (0) | 2023.08.12 |
Node.js) 백준 14916번: 거스름돈 (0) | 2023.08.10 |
Node.js) 백준 9655번: 돌 게임 (0) | 2023.08.10 |
Node.js) 백준 14581번: 팬들에게 둘러싸인 홍준 (0) | 2023.08.10 |
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- create db
- 면접비
- 동적프로그래밍
- 투포인터 연습
- 은둔청년체험
- MOD
- MySQL
- BFS
- 그래프
- 투포인터
- create databases;
- 최소공통조상
- 다이나믹프로그래밍
- 서버점검
- 면접질문
- 롱베케이션
- node.js
- 서버개발
- DB 생성
- 개발자면접
- 로드나인
- 다이나밍프로그래밍
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함