Notice
Recent Posts
Recent Comments
Link
«   2025/10   »
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 29 30 31
Archives
Today
Total
관리 메뉴

코딩로그

[백준/BOJ/C++] 15000번 CAPS 본문

YJ/C++

[백준/BOJ/C++] 15000번 CAPS

Team DAON 2021. 10. 15. 16:21

[문제]

Earth is under attack! Messages need to be sent to the Earth Defense Force (EDF) that makes clear that the situation is dire. The EDF’s strongest forces consist of mechs (huge bipedal robots) that are piloted by Japanese teenagers. To make sure that the messages come across as urgent, they must be displayed on the monitors of the pilots in uppercase letters. Unfortunately, the tachyon communication system that is used by the EDF is only able to send strings in lower-case alphabetic characters.

The set of lower-case alphabetic characters is made up of the following characters: ’a’, ’b’, ’c’, ’d’, ’e’, ’f’, ’g’, ’h’, ’i’, ’j’, ’k’, ’l’, ’m’, ’n’, ’o’, ’p’, ’q’, ’r’, ’s’, ’t’, ’u’, ’v’, ’w’, ’x’, ’y’, ’z’.

Your job is to write a program that converts the given messages to upper-case.

 

[입력]

A single line containing a string of length n (100 ≤ n ≤ 106), consisting of lower-case alphabetic characters.

 

[출력]

A single line containing the input string where all letters are converted to upper-case letters.

 

[Source Code]

#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main() {
	string s;
	cin >> s;

	for(int i = 0; i < s.length(); i++){
		s[i] =  s[i] - 32;
	}
	cout << s;
}

[결과 화면]

'YJ > C++' 카테고리의 다른 글

[백준/BOJ/C++] 9316번 Hello Judge  (0) 2021.10.18
[백준/BOJ/C++] 15963번 CASIO  (0) 2021.10.18
[백준/BOJ/C++] 14918번 더하기  (0) 2021.10.15
[백준/BOJ/C++] 11365번 !밀비 급일  (0) 2021.10.15
[백준/BOJ/C++] 10821번 정수의 개수  (0) 2021.10.15