aboutsummaryrefslogtreecommitdiff
path: root/codechef/MagicalDoors/main.cpp
blob: 91b03a6132cf4becf272e5d5987b238b78fdfa54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include<bits/stdc++.h>

using namespace std;

int main () {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int tt;
	cin >> tt;
	while(tt--){
    string s;
    cin >> s;
    int ans = 0, x = 0;
    for (auto ch : s) {
      char c = '0' + (x ^ (ch - '0'));
      ans += (c == '0');
      x ^= (c == '0');
    }
    cout << ans << '\n';
	}
}