https://www.acmicpc.net/problem/1439
#include <iostream>
#include <queue>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
string str;
cin >> str;
int countArr[2]={0,0};
int comp = str[0];
countArr[str[0] - '0']++;
for (int i = 1; i < str.length(); i++) {
if (str[i] != comp) {
comp = str[i];
countArr[str[i] - '0']++;
}
}
cout << min(countArr[0], countArr[1]) << "\n";
}
https://tooo1.tistory.com/247
이 사람은 i와 i+1의 숫자가 다른 경우만 세주어 풀었다.
코드가 가장 간결하고 좋지만, 이해하기에는 어려운 코드인 것 같다