Algorithm/Programers - C++
[프로그래머스]이상한 문자 만들기
StrongMin
2022. 2. 21. 01:35
문제
풀이
#include <string>
#include <vector>
#include <cstring>
using namespace std;
string solution(string s) {
int n = 0;
for(int i=0; i<s.length(); i++, n++){
if(s[i] == ' '){
n=-1;
continue;
}
n&1?s[i]=tolower(s[i]):s[i]=toupper(s[i]);
}
return s;
}