https://programmers.co.kr/learn/courses/30/lessons/12951
#include <string>
#include <vector>
using namespace std;
string solution(string s) {
string answer = "";
for(int i=0;i<s.size();i++){
if(i == 0 || s[i-1]== ' '){
if(s[i]>='a' && s[i]<='z'){ // 소문자
s[i] = 'A' + (s[i]-'a');
}
}else{
if(s[i]>='A' && s[i]<='Z'){ // 대문자
s[i] = 'a' + (s[i]-'A');
}
}
}
return s;
}
#include <string>
#include <vector>
using namespace std;
string solution(string s) {
string answer = "";
answer += toupper(s[0]);
for (int i = 1; i < s.size(); i++)
s[i - 1] == ' ' ? answer += toupper(s[i]) : answer += tolower(s[i]);
return answer;
}