func_code_string: #include <bits/stdc++.h>   using namespace std;   const long long INF = LLONG_MAX / 2;   int extractMin(set<int> &mySet) {     set<int>::iterator it = mySet.begin();     int ans = *(it);     mySet.erase(it);     return ans;   }   int search(set<int> &mySet, int index) {     set<int>::iterator it = mySet.lower_bound(index);     if (it == mySet.end()) {       return -1;     }     int ans = *(it);     return ans;   }   void eliminate(set<int> &mySet, int index) {     set<int>::iterator it = mySet.lower_bound(index);     if (it == mySet.end()) {       assert(false);     }     mySet.erase(it);   }   void notFound() { cout << -1 <<   n ; }   void impr(vector<vector<int> > ans) {     printf( %d n , ((int)(ans).size()));     for (int i = 0; i < ((int)(ans).size()); i++) {       printf( %d , ((int)(ans[i]).size()));       for (int j = 0; j < ((int)(ans[i]).size()); j++) {         printf(  %d , ans[i][j] + 1);       }       puts(  );     }   }   void solve(string str) {     int n = ((int)(str).size());     set<int> zeroes, ones;     for (int i = 0; i < n; i++) {       if (str[i] ==  0 ) {         zeroes.insert(i);       } else {         ones.insert(i);       }     }     vector<vector<int> > ans;     while (true) {       if (zeroes.empty() && ones.empty()) {         break;       }       if (zeroes.empty()) {         notFound();         return;       }       int curZero = extractMin(zeroes);       vector<int> seq(1, curZero);       while (true) {         int curOne = search(ones, curZero + 1);         curZero = search(zeroes, curOne + 1);         if (curOne == -1 || curZero == -1) {           break;         }         seq.push_back(curOne);         seq.push_back(curZero);         eliminate(ones, curOne);         eliminate(zeroes, curZero);       }       ans.push_back(seq);     }     impr(ans);   }   int main() {     string str;     while (cin >> str) {       solve(str);     }   }   