func_code_string: #include <bits/stdc++.h>   using namespace std;   template <typename T>   inline T read() {     T x = 0, f = 1;     char c = getchar();     while (!isdigit(c)) {       if (c ==  - ) f = -f;       c = getchar();     }     while (isdigit(c)) {       x = (x << 3) + (x << 1) + (c - 48);       c = getchar();     }     return x * f;   }   const int inf = 1e9 + 1e7, MAXN = 2e5 + 1e1;   int a[MAXN], b[MAXN], q0[MAXN], q1[MAXN], n, ans, cnt, a0, a1, l0, r0, l1, r1;   void Solve() {     n = read<int>(), ans = cnt = a0 = a1 = l0 = r0 = l1 = r1 = 0;     for (int i = 1; i <= n; i++) scanf( %1d , &a[i]);     for (int i = 1; i <= n; i++) {       if (a[i]) {         if (a1)           --a1, ++a0, b[i] = q1[l1], q0[r0++] = q1[l1++];         else           ++ans, ++a0, b[i] = (++cnt), q0[r0++] = cnt;       } else {         if (a0)           --a0, ++a1, b[i] = q0[l0], q1[r1++] = q0[l0++];         else           ++ans, ++a1, b[i] = (++cnt), q1[r1++] = cnt;       }     }     printf( %d n , ans);     for (int i = 1; i <= n; i++) printf( %d  , b[i]);     printf(  n );     return;   }   int main(void) {     int t = read<int>();     while (t--) Solve();     return 0;   }   