https://github.com/GyungSikHan/AlgorithmTest/tree/main/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4/2/12951.%E2%80%85JadenCase%E2%80%85%EB%AC%B8%EC%9E%90%EC%97%B4%E2%80%85%EB%A7%8C%EB%93%A4%EA%B8%B0
#include <string>
#include <vector>
#include <ctype.h>
using namespace std;
string solution(string s)
{
string answer = "";
answer = toupper(s[0]);
for (int i = 1; i < s.size(); i++)
{
if (s[i - 1] == ' ')
answer += toupper(s[i]);
else
answer += tolower(s[i]);
}
return answer;
}
- toupper은 문자를 대문자로 바꿔주는 함수
- tolower은 문자를 소문자로 바꿔주는 함수
- 이 두 함수는 ctype 헤더안에 있는 함수로 이를 이용하면 쉽게 구할 수 있는 문제였다