func_code_string: #include <bits/stdc++.h>   const unsigned int M = 1000000007;   long long power(long long x, long long y) {     long long res = 1;     while (y > 0) {       if (y & 1) res = x * res;       y = y >> 1;       x = x * x;     }     return res;   }   long long power(long long x, long long y, long long mod) {     long long res = 1;     while (y > 0) {       if (y & 1) res = x * res % mod;       y = y >> 1;       x = x * x % mod;     }     return res;   }   using namespace std;   void nik() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);   }   signed main() {     nik();     long long test = 1;     cin >> test;     while (test--) {       long long one[100005] = {0};       string s;       cin >> s;       long long n = s.size();       s =     + s;       for (long long i = 1; i <= n; i++) {         if (s[i] ==  1 )           one[i] = one[i - 1] + 1;         else           one[i] = one[i - 1];       }       long long ans = min(one[n], n - one[n]);       if (ans == 0) {         cout << ans <<   n ;         continue;       }       for (long long i = 1; i <= n; i++) {         ans = min(ans, i - one[i] + one[n] - one[i]);       }       long long b = ans;       for (long long i = n; i >= 1; i--) {         b = min(b, (n - i + 1) - (one[n] - one[i - 1]) + one[i - 1]);       }       cout << min(ans, b) <<   n ;     }     return 0;   }   