๋ฌธ์
์ฝ๋
#include <string>
#include <vector>
using namespace std;
string solution(string s) {
string answer = "";
int cnt=0;
for(int i=0; i<s.length(); i++){
bool flag=false;
if(s[i]==' '){
cnt=0;
flag=true;
continue;
}
if(cnt%2==0) s[i]=toupper(s[i]); //์ง์๋ฒ์งธ์ผ๋ ๋๋ฌธ์๋ก
else s[i]=tolower(s[i]); //ํ์๋ฒ์งธ์ผ๋ ์๋ฌธ์๋ก
cnt++;
}
answer=s;
return answer;
}
๋๊ธ