#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char n,cs[MAXN];
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(cur<k){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            s.erase(x);
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(x);
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.lower_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
                x=e;
            }
        }
        ++cur;
    }
    return true;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char n,cs[MAXN];
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(!s.empty()){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            s.erase(s.begin());
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(s.begin());
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.upper_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
                x=e;
            }
        }
        ++cur;
    }
    if(cur!=k)while(1);
    return true;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char n,cs[MAXN];
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(!s.empty()){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            s.erase(s.begin());
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(s.begin());
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.upper_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
                x=e;
            }
        }
        ++cur;
    }
    return true;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char n,cs[MAXN];
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(cur<k){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            s.erase(x);
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(x);
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.lower_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
            }
        }
        ++cur;
    }
    return true;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char n,cs[MAXN];
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(cur<k){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(x);
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.lower_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
            }
        }
        ++cur;
    }
    return true;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char n,cs[MAXN];
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(!s.empty()){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            s.erase(x);
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(s.begin());
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.lower_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
                x=e;
            }
        }
        ++cur;
    }
    return cur==k;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
const int MAXN=200100;
char cs[MAXN];
int n;
struct node{
    int l,r;
    bool operator<(const node& a)const{
        return l<a.l;
    }
};
set<node> s;
vector<int> ans[MAXN];
bool solve(int k){
    queue<int> z;
    //cout<<k<<endl;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')z.push(i);
        else{
            if(z.empty())return 0;
            int u=z.front();
            z.pop();
            s.insert(node{u,i});
        }
    }
    while(!z.empty()){
        int u=z.front();
        z.pop();
        s.insert(node{u,u});
    }
    int cur=0;
    while(!s.empty()){
        node x=*s.begin();
        //cout<<x.l<<" "<<x.r<<endl;
        if(x.l==x.r){
            ans[cur].push_back(x.l);
            s.erase(s.begin());
            ++cur;
            continue;
        }
        ans[cur].push_back(x.l);
        ans[cur].push_back(x.r);
        s.erase(s.begin());
        while(1){
            node cmp=node{x.r,x.r};
            set<node>:: iterator it=s.upper_bound(cmp);
            if(it==s.end())return false;
            node e=*it;
            s.erase(it);
            if(e.l==e.r){
                ans[cur].push_back(e.l);
                break;
            }
            else{
                ans[cur].push_back(e.l);
                ans[cur].push_back(e.r);
                x=e;
            }
        }
        ++cur;
    }
    if(cur!=k)while(1);
    return true;
}
int main(){
    scanf("%s",cs+1);
    n=strlen(cs+1);
    int zero=0,one=0;
    for(int i=1;i<=n;++i){
        if(cs[i]=='0')++zero;
        else ++one;
    }
    int k=zero-one;
    if(k<=0||!solve(k)){
        puts("-1");
        return 0;
    }
    printf("%d\n",k);
    for(int i=0;i<k;++i){
        printf("%d ",ans[i].size());
        for(int j=0;j<ans[i].size();++j)printf("%d%c",ans[i][j]," \n"[j==ans[i].size()-1]);
    }
}


#include<bits/stdc++.h>
using namespace std;
bool vis[200005];
int main ()
{
    string s;
    cin >> s;
    set < int > zeros , ones ;
    for(int i =0 ; i <s.size() ; i++){
        if (s[i]  == '0')
            zeros.insert(i+1);
        else ones.insert(i+1);
    }
    vector < vector < int > > ans;
    int cnt = 0;
    while (1){
        vector < int > temp;
        int it = *zeros.begin();
        if (zeros.empty())
            return puts("-1");
        else
        {
            temp.push_back(it);
            zeros.erase(zeros.begin());
            cnt++;
        }
        while (1){
            bool b = 1;
            if (ones.upper_bound(it) == ones.end())
                b=0;
            int r=*(ones.upper_bound(it));
            if (zeros.upper_bound(r) == zeros.end())
                b=0;
            it = *zeros.upper_bound(r);
            if (!b)
                break;
            else {
                temp.push_back(r);
                temp.push_back(it);
                ones.erase(r);
                zeros.erase(it);
                cnt+=2;
            }
        }
        if (temp.size() == 1){
            if (ones.size() == 0){
                ans.push_back(temp);
                for(auto it :zeros){
                    vector<int > zz;
                    zz.push_back(it);
                    cnt++;
                    ans.push_back(zz);
                }
                    break;
            }
            else
                return puts("-1");
        }
        if (temp.size() == 0){
            if (cnt == s.size())
                break;
            else
                return puts("-1");
        }
        ans.push_back(temp);
    }
    cout << ans.size() << endl;
    for(int i =0 ; i <ans.size() ; i++)
    {
        cout <<ans[i].size()<<' ' ;
        for(int j =0 ; j<ans[i].size() ; j++)
            cout << ans[i][j]<<' ' ;
        cout << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool vis[200005];
int main ()
{
    string s;
    cin >> s;
    vector<vector<int > > ans;
    int cnt = 0 ;
    while (1)
    {
        bool b = 0;
        vector <int > temp,zeros;
        for(int i =0 ; i <s.size() ; i++)
        {
            if (vis[i])
                continue;
            if (s[i] == '0')
                zeros.push_back(i+1);
            if (b == 0 && s[i] == '0')
                temp.push_back(i+1),b=!b;
            else if (b == 1 && s[i] == '1')
                temp.push_back(i+1),b=!b;
        }

        if (temp.size() != 0 && s[temp.back()-1] == '1')
            temp.pop_back();
        if (temp.size() == 1)
        {
            for(int j = 0 ; j<zeros.size() ; j++)
            {
                vector < int > r;
                r.push_back(zeros[j]);
                ans.push_back(r);
                cnt++;
                vis[zeros[j]-1]=1;
            }
        }
        else
        {
            if (temp.size() == 0)
            {
                if (cnt != s.size())
                    return puts("-1");
                else
                    break;
            }
            ans.push_back(temp);
            for(int j =0 ; j<temp.size() ; j++)
                vis[temp[j]-1]=1,cnt++;

        }
    }
    for(int i =0 ; i <ans.size() ; i++)
    {
        cout <<ans[i].size()<<' ' ;
        for(int j =0 ; j<ans[i].size() ; j++)
            cout << ans[i][j]<<' ' ;
        cout << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool vis[200005];
int main ()
{
    string s;
    cin >> s;
    vector<vector<int > > ans;
    int cnt = 0 ;
    while (1)
    {
        bool b = 0;
        vector <int > temp,zeros;
        for(int i =0 ; i <s.size() ; i++)
        {
            if (vis[i])
                continue;
            if (s[i] == '0')
                zeros.push_back(i+1);
            if (b == 0 && s[i] == '0')
                temp.push_back(i+1),b=!b;
            else if (b == 1 && s[i] == '1')
                temp.push_back(i+1),b=!b;
        }

        if (temp.size() != 0 && s[temp.back()-1] == '1')
            temp.pop_back();
        if (temp.size() == 1)
        {
            for(int j = 0 ; j<zeros.size() ; j++)
            {
                vector < int > r;
                r.push_back(zeros[j]);
                ans.push_back(r);
                cnt++;
                vis[zeros[j]-1]=1;
            }
        }
        else
        {
            if (temp.size() == 0)
            {
                if (cnt != s.size())
                    return puts("-1");
                else
                    break;
            }
            ans.push_back(temp);
            for(int j =0 ; j<temp.size() ; j++)
                vis[temp[j]-1]=1,cnt++;

        }
    }
    cout << ans.size() << endl;
    for(int i =0 ; i <ans.size() ; i++)
    {
        cout <<ans[i].size()<<' ' ;
        for(int j =0 ; j<ans[i].size() ; j++)
            cout << ans[i][j]<<' ' ;
        cout << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
bool vis[200005];
int main ()
{
    string s;
    cin >> s;
    set < int > zeros , ones ;
    for(int i =0 ; i <s.size() ; i++){
        if (s[i]  == '0')
            zeros.insert(i+1);
        else ones.insert(i+1);
    }
    vector < vector < int > > ans;
    int cnt = 0;
    while (1){
        vector < int > temp;
        int it = *zeros.begin();
        if (zeros.empty())
            return puts("-1");
        else
        {
            temp.push_back(it);
            zeros.erase(zeros.begin());
            cnt++;
        }
        while (1){
            bool b = 1;
            if (ones.upper_bound(it) == ones.end())
                b=0;
            int r=*(ones.upper_bound(it));
            if (zeros.upper_bound(r) == zeros.end())
                b=0;
            it = *zeros.upper_bound(r);
            if (!b)
                break;
            else {
                temp.push_back(r);
                temp.push_back(it);
                ones.erase(r);
                zeros.erase(it);
                cnt+=2;
            }
        }
        if (cnt == s.size()){
            ans.push_back(temp);
            break;
        }
        if (temp.size() == 1){
            if (ones.size() == 0){
                ans.push_back(temp);
                for(auto it :zeros){
                    vector<int > zz;
                    zz.push_back(it);
                    cnt++;
                    ans.push_back(zz);
                }
                    break;
            }
            else
                return puts("-1");
        }
        if (temp.size() == 0){
            if (cnt == s.size())
                break;
            else
                return puts("-1");
        }
        ans.push_back(temp);
    }
    cout << ans.size() << endl;
    for(int i =0 ; i <ans.size() ; i++)
    {
        cout <<ans[i].size()<<' ' ;
        for(int j =0 ; j<ans[i].size() ; j++)
            cout << ans[i][j]<<' ' ;
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 2e5 + 5;

string s;
int taken[MAX_N];
int cnt;
int n;

int main() {
	FAST_IO();

	cin >> s;
	n = s.length();
	REP(i, n) {
		if (s[i] == '0') ++cnt;
	}
	int cur = 0;
	char last;
	REP(i, n) {
		if (taken[i]) continue;
		++cur;
		if (s[i] == '1') {
			cur = 0;
			break;
		} else if (s[i] == '0') {
			last = '0';
			--cnt;
			taken[i] = cur;
			FOR(j, i+1, n-1) {
				if (taken[j]) continue;
				if (s[j] == '0' && last == '1') {
						taken[j] = cur;
						last = '0';
						--cnt;
				}
				if (s[j] == '1' && last == '0' && cnt > 0) {
						last = '1';
						taken[j] = cur;
					}
				}
			}
	}
	REP(i, n) {
		if (!taken[i]) {
			cur = 0;
			break;
		}
	}
	if (cur == 0) cout << -1 << endl;
	else {
		cout << cur << endl;
		int ans = cur;
		cur = 1;
		REP(i, ans) {
			string sb = "";
			int len = 0;
			REP(j, n) {
				if (taken[j] == cur) {
					sb += " " + to_string(j + 1);
					++len;
				}
			}
			cout << len << sb << endl;
			++cur;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 2e5 + 5;

string s;
int N;
int taken[MAX_N];
vector<string> answers;
set<int> zeros;
set<int> ones;

void impossible() {
	cout << -1 << endl;
	exit(0);
}

int main() {
	FAST_IO();

	cin >> s;
	N = s.length();
	REP(i, N) {
		if (s[i] == '0') zeros.insert(i+1);
		else ones.insert(i+1);
	}
	while (!zeros.empty()) {
		auto it0 = zeros.begin();
		auto it1 = ones.upper_bound(*it0);
		string temp = " " + to_string(*it0);
		// cout << *it0 << endl;
		while (it1 != ones.end()) {
			auto it0 = zeros.upper_bound(*it1);
			if (it0 == zeros.end()) break;
			temp += " " + to_string(*it1) + " " + to_string(*it0);

			ones.erase(it1);
			it1 = ones.upper_bound(*it0);
			zeros.erase(it0);
			if (ones.empty()) break;
		}
		zeros.erase(zeros.begin());
		answers.pb(to_string(temp.length() / 2) + temp);
	}
	if (!zeros.empty() || !ones.empty()) impossible();
	cout << answers.size() << endl;
	for (auto answer: answers) {
		cout << answer << endl;
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}

#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 2e5 + 5;

string s;
int taken[MAX_N];
int cnt;
int n;

int main() {
	FAST_IO();

	cin >> s;
	n = s.length();
	REP(i, n) {
		if (s[i] == '0') ++cnt;
	}
	int cur = 0;
	char last;
	REP(i, n) {
		if (taken[i]) continue;
		++cur;
		if (s[i] == '1') {
			cur = 0;
			break;
		} else if (s[i] == '0') {
			last = '0';
			--cnt;
			taken[i] = cur;
			int cnt_zero_before = 0;
			FOR(j, i+1, n-1) {
				if (taken[j]) continue;
				if (s[j] == '0') {
					++cnt_zero_before;
					if (last == '1') {
						taken[j] = cur;
						last = '0';
						--cnt_zero_before;
					}
				}
				if (s[j] == '1' && last == '0' && cnt-cnt_zero_before > 0) {
						last = '1';
						taken[j] = cur;
						--cnt;
					}
				}
			}
	}
	REP(i, n) {
		if (!taken[i]) {
			cur = 0;
			break;
		}
	}
	if (cur == 0) cout << -1 << endl;
	else {
		cout << cur << endl;
		int ans = cur;
		cur = 1;
		REP(i, ans) {
			string sb = "";
			int len = 0;
			REP(j, n) {
				if (taken[j] == cur) {
					sb += " " + to_string(j + 1);
					++len;
				}
			}
			cout << len << sb << endl;
			++cur;
		}
	}
	return 0;
}


#include <bits/stdc++.h>

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 2e5 + 5;

string s;
int N;

set<int> zebras;
set<int> almost_zebras;

int par[MAX_N];

void impossible() {
	cout << -1 << endl;
	exit(0);
}

int main() {
	FAST_IO();

	cin >> s;
	N = s.length();
	REP(i, N) {
		if (s[i] == '0') {
			if (!almost_zebras.empty()) {
				par[i+1] = *almost_zebras.begin();
				almost_zebras.erase(almost_zebras.begin());
			}
			zebras.insert(i+1);
		} else {
			if (zebras.empty()) impossible();
			par[i+1] = *zebras.begin();
			almost_zebras.insert(i+1);
			zebras.erase(zebras.begin());
		}
	}
	if (!almost_zebras.empty()) impossible();
	cout << zebras.size() << endl;
	for (auto zebra : zebras) {
		vi ans;
		int cur = zebra;
		while (par[cur] != 0) {
			// cerr << "#" << cur << endl;
			ans.pb(cur);
			cur = par[cur];
		}
		ans.pb(cur);
		int len = ans.size();
		cout << len;
		FORD(i, len-1, 0) {
			cout << " " << ans[i];
		}
		cout << newline;
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 2e5 + 5;

string s;
int N;
int taken[MAX_N];
vector<string> answers;
set<string> zebras;
set<string> almost_zebras;

void impossible() {
	cout << -1 << endl;
	exit(0);
}

int main() {
	FAST_IO();

	cin >> s;
	N = s.length();
	REP(i, N) {
		if (s[i] == '0') {
			if (!almost_zebras.empty()) {
				zebras.insert(*almost_zebras.begin() + " " + to_string(i+1));
				almost_zebras.erase(almost_zebras.begin());
			}	else {
				zebras.insert(" " + to_string(i+1));
			}
		} else {
			if (zebras.empty()) impossible();
			almost_zebras.insert(*zebras.begin() + " " + to_string(i+1));
			zebras.erase(zebras.begin());
		}
	}
	if (!almost_zebras.empty()) impossible();
	cout << zebras.size() << endl;
	for (auto zebra : zebras) {
		cout << zebra.length() / 2 << zebra << endl;
	}

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

void FAST_IO() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
}
#define REP(_i, _a) for(int _i = 0; _i < _a; ++_i)
#define FOR(_i, _a, _b) for(int _i = _a; _i <= _b; ++_i)
#define FORD(_i, _a, _b) for(int _i = _a; _i >= _b; --_i)
#define RESET(_a, _value) memset(_a, _value, sizeof(_a))
#define ALL(_a) _a.begin(), _a.end()
#define SIZE(_a) _a.size()
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define newline '\n';

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;

const int PI = acos(-1.0);
const int MOD = 1e9 + 7;
const int INF = 2e9;

const int MAX_N = 2e5 + 5;

string s;
int N;
int taken[MAX_N];
vector<string> answers;
set<string> zebras;
set<string> almost_zebras;

void impossible() {
	cout << -1 << endl;
	exit(0);
}

int main() {
	FAST_IO();

	cin >> s;
	N = s.length();
	REP(i, N) {
		if (s[i] == '0') {
			if (!almost_zebras.empty()) {
				zebras.insert(*almost_zebras.begin() + " " + to_string(i+1));
				almost_zebras.erase(almost_zebras.begin());
			}	else {
				zebras.insert(" " + to_string(i+1));
			}
		} else {
			if (zebras.empty()) impossible();
			almost_zebras.insert(*zebras.begin() + " " + to_string(i+1));
			zebras.erase(zebras.begin());
		}
	}
	if (!almost_zebras.empty()) impossible();
	cout << zebras.size() << endl;
	for (auto zebra : zebras) {
		int n = zebra.length();
		int cnt_space = 0;
		REP(i, n) {
			if (zebra[i] == ' ') ++cnt_space;
		}
		cout << cnt_space << zebra << endl;
	}

	return 0;
}


#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;

inline char gc()
{
        static const int L = 1000;
        static char sxd[L], *sss = sxd, *ttt = sxd;
        if(sss == ttt)
        {
                ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
                if(sss == ttt)
                        return EOF;
        }
        return *sss++;
}

#define dd c = getchar()
inline int read(int& x)
{
        x = 0;
        char dd;
        bool f = false;
        for(; !isdigit(c); dd)
        {
                if(c == EOF)
                        return -1;
                if(c == '-')
                        f = true;
        }
        for(; isdigit(c); dd)
                x = (x << 1) + (x << 3) + (c ^ 48);
        if(f)
                x = -x;
        return 1;
}
#undef dd

char s[200005];//kjfhaakljfhjkadjhfaflfh
int i,j,l,t,k;
vector<int>q[200005];
int main()
{
    gets(s);
    l=strlen(s);
    for(i=0;i<l;i++)
    {
        if(s[i]=='0')
        {
            q[t].push_back(i+1);
            t++;
        }
        else
        {
            if(t==0)
            {
                puts("-1");
                return 0;
            }
            t--;
            q[t].push_back(i+1);
        }
        k=max(k,t);
    }
    if(t!=k)
    {
        puts("-1");
        return 0;
    }
    printf("%d\n",t);
    for(i=0;i<t;i++)
    {
        cout<<q[i].size();
        for(j=0;j<q[i].size();j++)
          printf(" %d",q[i][j]);
        puts("");//fbjkajk4987yradf
    }
    return 0;
}


#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;

inline char gc()
{
		static const int L = 1000;
		static char sxd[L], *sss = sxd, *ttt = sxd;
		if(sss == ttt)
		{
				ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
				if(sss == ttt)
						return EOF;
		}
		return *sss++;
}

#define dd c = getchar()
inline int read(int& x)
{
		x = 0;
		char dd;
		bool f = false;
		for(; !isdigit(c); dd)
		{
				if(c == EOF)
						return -1;
				if(c == '-')
						f = true;
		}
		for(; isdigit(c); dd)
				x = (x << 1) + (x << 3) + (c ^ 48);
		if(f)
				x = -x;
		return 1;
}
#undef dd

char s[200005];//kjfhaakljfhjkadjhfaflfh
int i,j,l,t,k;
vector<int>q[200005];
int main()
{
	gets(s);
	l=strlen(s);
	for(i=0;i<l;i++)
	{
		if(s[i]=='0')
		{
			q[t].push_back(i+1);
			t++;
		}
		else
		{
			if(t==0)
			{
				puts("-1");
				return 0;
			}
			t--;
			q[t].push_back(i+1);
		}
		k=max(k,t);
	}
	if(t!=k)
	{
		puts("-1");
		return 0;
	}
	printf("%d\n",t);
	for(i=0;i<t;i++)
	{
		cout<<q[i].size();
		for(j=0;j<q[i].size();j++)
		  printf(" %d",q[i][j]);
		puts("");
	}
	return 0;
}


#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;

inline char gc()
{
		static const int L = 1000;
		static char sxd[L], *sss = sxd, *ttt = sxd;
		if(sss == ttt)
		{
				ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
				if(sss == ttt)
						return EOF;
		}
		return *sss++;
}

#define dd c = getchar()
inline int read(int& x)
{
		x = 0;
		char dd;
		bool f = false;
		for(; !isdigit(c); dd)
		{
				if(c == EOF)
						return -1;
				if(c == '-')
						f = true;
		}
		for(; isdigit(c); dd)
				x = (x << 1) + (x << 3) + (c ^ 48);
		if(f)
				x = -x;
		return 1;
}
#undef dd

char s[200005];//kjfhaakljfhjkalfh
int i,j,l,t,k;
vector<int>q[200005];
int main()
{
	gets(s);
	l=strlen(s);
	for(i=0;i<l;i++)
	{
		if(s[i]=='0')
		{
			q[t].push_back(i+1);
			t++;
		}
		else
		{
			if(t==0)
			{
				puts("-1");
				return 0;
			}
			t--;
			q[t].push_back(i+1);
		}
		k=max(k,t);
	}
	if(t!=k)
	{
		puts("-1");
		return 0;
	}
	printf("%d\n",t);
	for(i=0;i<t;i++)
	{
		cout<<q[i].size();
		for(j=0;j<q[i].size();j++)
		  printf(" %d",q[i][j]);
		puts("");
	}
	return 0;
}


#pragma GCC optimize(3)
#include<bits/stdc++.h>
using namespace std;

inline char gc()
{
		static const int L = 1000;
		static char sxd[L], *sss = sxd, *ttt = sxd;
		if(sss == ttt)
		{
				ttt = (sss = sxd) + fread(sxd, 1, L, stdin);
				if(sss == ttt)
						return EOF;
		}
		return *sss++;
}

#define dd c = getchar()
inline int read(int& x)
{
		x = 0;
		char dd;
		bool f = false;
		for(; !isdigit(c); dd)
		{
				if(c == EOF)
						return -1;
				if(c == '-')
						f = true;
		}
		for(; isdigit(c); dd)
				x = (x << 1) + (x << 3) + (c ^ 48);
		if(f)
				x = -x;
		return 1;
}
#undef dd

char s[200005];
int i,j,l,t,k;
vector<int>q[200005];
int main()
{
	gets(s);
	l=strlen(s);
	for(i=0;i<l;i++)
	{
		if(s[i]=='0')
		{
			q[t].push_back(i+1);
			t++;
		}
		else
		{
			if(t==0)
			{
				puts("-1");
				return 0;
			}
			t--;
			q[t].push_back(i+1);
		}
		k=max(k,t);
	}
	if(t!=k)
	{
		puts("-1");
		return 0;
	}
	printf("%d\n",t);
	for(i=0;i<t;i++)
	{
		cout<<q[i].size();
		for(j=0;j<q[i].size();j++)
		  printf(" %d",q[i][j]);
		puts("");
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  vector<vector<int> > ans;
  queue<P> que[2];
  rep(i,s.size())que[0].push(P(s[i]=='1',i));
  int t=0;
  while(!que[t].empty()) {
    vector<int> v;
    int k=0;
    while(!que[t].empty()) {
      P p=que[t].front();que[t].pop();
      if(k==p.F) {
        v.pb(p.S+1);
        k^=1;
      } else que[t^1].push(p);
    }
    if(!v.size()||!k) {
      pr(-1);
      return;
    }
    ans.pb(v);
    t^=1;
  }
  pr(ans.size());
  rep(i,ans.size()) {
    cout << ans[i].size() << " ";
    PR(ans[i],ans[i].size());
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  vector<vector<int> > ans;
  queue<P> que[2];
  int cnt=0;
  rep(i,s.size()) {
    que[0].push(P(s[i]=='1',i));
    if(s[i]=='1') cnt++;
  }
  int t=0;
  while(!que[t].empty()) {
    if(!cnt) {
      while(!que[t].empty()) {
        P p=que[t].front();que[t].pop();
        vector<int> a;
        a.pb(p.S+1);
        ans.pb(a);
      }
      break;
    }
    vector<int> v;
    int k=0;
    while(!que[t].empty()) {
      P p=que[t].front();que[t].pop();
      if(k==p.F) {
        v.pb(p.S+1);
        k^=1;
        if(p.F==1) cnt--;
      } else que[t^1].push(p);
    }
    if(!v.size()||!k) {
      pr(-1);
      return;
    }
    ans.pb(v);
    t^=1;
  }
  pr(ans.size());
  rep(i,ans.size()) {
    cout << ans[i].size() << " ";
    PR(ans[i],ans[i].size());
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

class RMQ{
public:
  int n;
  P dat[555555];
  void init(int _n){
    n=1;
    while(n<_n)n*=2;
    rep(i,2*n) dat[i]=P(MAX,-1);
  }
  void update(int k,P a){
    k+=n-1;dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }
  P query(int a,int b){return query(a,b,0,0,n);}
  P query(int a,int b,int k,int l,int r){
    if(r<=a||b<=l) return P(MAX,-1);
    if(a<=l&&r<=b) return dat[k];
    P vl=query(a,b,k*2+1,l,(l+r)/2);
    P vr=query(a,b,k*2+2,(l+r)/2,r);
    return min(vl,vr);
  }
};

RMQ r[2];
vector<int> ans[222222];
void Main() {
  rep(i,2)r[i].init(222222);
  rep(i,222222) {
    r[0].update(i,P(1,i));
    r[1].update(i,P(-1,i));
  }
  string s;
  R s;
  int M=0;
  rep(i,s.size()) {
    if(s[i]=='0') {
      P p=r[1].query(0,222222);
      M=max(M,p.S);
      ans[p.S].pb(i+1);
      r[0].update(p.S,P(0,p.S));
      r[1].update(p.S,P(0,p.S));
    } else {
      P p=r[0].query(0,222222);
      if(p.F==1) {
        pr(-1);
        return;
      }
      M=max(M,p.S);
      ans[p.S].pb(i+1);
      r[0].update(p.S,P(1,p.S));
      r[1].update(p.S,P(-1,p.S));
    }
  }
  rep(i,M+1) {
    if(ans[i].size()%2==0) {
      pr(-1);
      return;
    }
  }
  pr(M+1);
  rep(i,M+1) {
    cout << ans[i].size() << " ";
    PR(ans[i],ans[i].size());
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1e9+7,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  vector<vector<int> > ans;
  queue<P> que[2];
  int cnt=0;
  rep(i,s.size()) {
    que[0].push(P(s[i]=='1',i));
    if(s[i]=='1') cnt++;
  }
  int t=0;
  while(!que[t].empty()) {
    if(!cnt) {
      while(!que[t].empty()) {
        P p=que[t].front();que[t].pop();
        vector<int> a;
        a.pb(p.S+1);
        ans.pb(a);
      }
      break;
    }
    if(que[t].size()<=cnt*2) {
      pr(-1);
      return;
    }
    vector<int> v;
    int k=0;
    while(!que[t].empty()) {
      P p=que[t].front();que[t].pop();
      if(k==p.F) {
        v.pb(p.S+1);
        k^=1;
        if(p.F==1) cnt--;
      } else que[t^1].push(p);
    }
    if(!v.size()||!k) {
      pr(-1);
      return;
    }
    ans.pb(v);
    t^=1;
  }
  pr(ans.size());
  rep(i,ans.size()) {
    cout << ans[i].size() << " ";
    PR(ans[i],ans[i].size());
  }
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  string s; cin>>s;
  int n = s.length();

  if (s.front()=='1' || s.back()=='1') out(-1);

  set<int> zeros,ones;
  for (int i=0; i<n; i++) {
    if (s[i]=='0') {
      zeros.insert(i);
    } else {
      ones.insert(i);
    }
  }

  vector<vector<int>> res;
  vector<int> ans;
  int last = -1;
  while (zeros.size()>0 || ones.size()>0) {
    int prevans = ans.size();
    assert(last<n);
    if (zeros.size()==0 && ones.size()>0) out(-1);

    if (ans.empty() || s[ans.back()]=='1') {
      auto iter = zeros.upper_bound(last);
      if (iter == zeros.end()) {
	if (ans.empty()) out(-1);
	ones.insert(ans.back());
	ans.pop_back();
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	last = *iter;
	assert(*iter < n);
	ans.push_back(*iter);
	zeros.erase(iter);
      }
    } else {
      auto iter = ones.upper_bound(last);
      if (iter == ones.end()) {
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	assert(*iter < n);
	ans.push_back(*iter);
	ones.erase(iter);
	last=*iter;
      }
    }
    if (prevans == (int)ans.size()) {
      out(-1); // failure to make progress
    }
  }

  if (!ans.empty()) {
    if (ans.back() == '1') out(-1);
    res.push_back(ans);
  }

  cout<<res.size()<<endl;
  for (auto v: res) {
    cout<<v.size()<<" ";
    for (auto i: v) cout<<i+1<<" ";
    cout<<"\n";
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

string s;
int n;
vector<vector<int>> ans; //contains i's
stack<int> last[2]; //contains idx's

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  cin>>s;
  n = s.length();

  for (int i=0; i<n; i++) {
    if (s[i]=='0') {
      if (last[1].empty()) {
	ans.push_back({i});
	int idx = (int)ans.size() - 1;
	last[0].push(idx);
      } else {
	int idx = last[1].top();
	last[1].pop();
	ans[idx].push_back(i);
	last[0].push(idx);
      }
    } if (s[i]=='1') {
      if (last[0].empty()) out(-1);
      int idx = last[0].top();
      last[0].pop();
      ans[idx].push_back(i);
      last[1].push(idx);
    }
  }

  if (!last[1].empty()) out(-1);

  cout<<ans.size()<<"\n";
  for (auto v: ans) {
    cout<<v.size()<<" ";
    for (auto i: v) {
      cout<<i+1<<" ";
    }
    cout<<"\n";
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  string s; cin>>s;
  int n = s.length();

  if (s.front()=='1' || s.back()=='1') out(-1);

  set<int> zeros,ones;
  for (int i=0; i<n; i++) {
    if (s[i]=='0') {
      zeros.insert(i);
    } else {
      ones.insert(i);
    }
  }

  vector<vector<int>> res;
  vector<int> ans;
  int last = -1;
  while (zeros.size()>0 || ones.size()>0) {
    assert(last<n);
    if (zeros.size()==0 && ones.size()>0) out(-1);

    if (ans.empty() || s[ans.back()]=='1') {
      auto iter = zeros.upper_bound(last);
      if (iter == zeros.end()) {
	if (ans.empty()) out(-1);
	ones.insert(ans.back());
	ans.pop_back();
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	last = *iter;
	assert(*iter < n);
	ans.push_back(*iter);
	zeros.erase(iter);
      }
    } else {
      auto iter = ones.upper_bound(last);
      if (iter == ones.end()) {
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	assert(*iter < n);
	ans.push_back(*iter);
	ones.erase(iter);
	last=*iter;
      }
    }
  }

  if (!ans.empty()) {
    if (ans.back() == '1') out(-1);
    res.push_back(ans);
  }

  cout<<res.size()<<endl;
  for (auto v: res) {
    cout<<v.size()<<" ";
    for (auto i: v) cout<<i+1<<" ";
    cout<<"\n";
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  string s; cin>>s;
  int n = s.length();

  if (s.front()=='1' || s.back()=='1') out(-1);

  set<int> zeros,ones;
  for (int i=0; i<n; i++) {
    if (s[i]=='0') {
      zeros.insert(i);
    } else {
      ones.insert(i);
    }
  }

  vector<vector<int>> res;
  vector<int> ans;
  int last = -1;
  while (zeros.size()>0 || ones.size()>0) {

    if (zeros.size()==0 && ones.size()>0) out(-1);

    if (ans.empty() || s[ans.back()]=='1') {
      auto iter = zeros.upper_bound(last);
      if (iter == zeros.end()) {
	if (ans.empty()) out(-1);
	ones.insert(ans.back());
	ans.pop_back();
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	last = *iter;
	ans.push_back(*iter);
	zeros.erase(iter);
      }
    } else {
      auto iter = ones.upper_bound(last);
      if (iter == ones.end()) {
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	ans.push_back(*iter);
	ones.erase(iter);
	last=*iter;
      }
    }
  }

  if (!ans.empty()) {
    if (ans.back() == '1') out(-1);
    res.push_back(ans);
  }

  cout<<res.size()<<endl;
  for (auto v: res) {
    cout<<v.size()<<" ";
    for (auto i: v) cout<<i+1<<" ";
    cout<<"\n";
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  string s; cin>>s;
  int n = s.length();

  if (s.front()=='1' || s.back()=='1') out(-1);

  set<int> zeros,ones;
  for (int i=0; i<n; i++) {
    if (s[i]=='0') {
      zeros.insert(i);
    } else {
      ones.insert(i);
    }
  }

  vector<vector<int>> res;
  vector<int> ans;
  int last = -1;
  while (zeros.size()>0 || ones.size()>0) {
    assert(last<n);
    if (zeros.size()==0 && ones.size()>0) out(-1);

    if (ans.empty() || s[ans.back()]=='1') {
      auto iter = zeros.upper_bound(last);
      if (iter == zeros.end()) {
	if (ans.empty()) out(-1);
	ones.insert(ans.back());
	ans.pop_back();
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	last = *iter;
	ans.push_back(*iter);
	zeros.erase(iter);
      }
    } else {
      auto iter = ones.upper_bound(last);
      if (iter == ones.end()) {
	res.push_back(ans);
	ans = {};
	last=-1;
      } else {
	ans.push_back(*iter);
	ones.erase(iter);
	last=*iter;
      }
    }
  }

  if (!ans.empty()) {
    if (ans.back() == '1') out(-1);
    res.push_back(ans);
  }

  cout<<res.size()<<endl;
  for (auto v: res) {
    cout<<v.size()<<" ";
    for (auto i: v) cout<<i+1<<" ";
    cout<<"\n";
  }

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

template<typename T>
void out(T x) { cout << x << endl; exit(0); }
#define watch(x) cout << (#x) << " is " << (x) << endl

const int maxn = 4e5 + 5;

string s;
int n;
vector<vector<int>> ans; //contains i's
stack<int> last[2]; //contains idx's

int main() {
  ios_base::sync_with_stdio(false); cin.tie(0);  cout.tie(0);

  cin>>s;
  n = s.length();

  for (int i=0; i<n; i++) {
    if (s[i]=='0') {
      if (last[1].empty()) {
	ans.push_back({i});
	int idx = (int)ans.size() - 1;
	last[0].push(idx);
      } else {
	int idx = last[1].top();
	last[1].pop();
	ans[idx].push_back(i);
	last[0].push(idx);
      }
    } if (s[i]=='1') {
      if (last[0].empty()) out(-1);
      int idx = last[0].top();
      last[0].pop();
      ans[idx].push_back(i);
      last[1].push(idx);
    }
  }

  if (!last[1].empty()) out(-1);

  for (auto v: ans) {
    cout<<v.size()<<" ";
    for (auto i: v) {
      cout<<i+1<<" ";
    }
    cout<<"\n";
  }

  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zebra;
  for (int i = 0; i < str.size(); i++) {
      bool ok = false;
      if (str[i] == '0') {
        for(vector<int>& z : zebra) {
          if(str[z.back()] == '1') {
            z.push_back(i); ok = true;
          }
        }
        if(!ok) {
          vector<int> a(1, i);
          zebra.push_back(a);
        }
      } else {
        for(vector<int>& z : zebra) {
          if(str[z.back()] == '0') {
            z.push_back(i); ok = true;
            break;
          }
        }
        if(!ok) {
          cout << "-1"; return 0;
        }
      }
    // cout << zebra << endl << endl;
  }
  for(vector<int>& z : zebra) {
    if(str[z.back()] == '1') {
      cout << -1; return 0;
    }
  }

  cout << zebra.size() << endl;
  for(auto z : zebra) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>
#include <chrono>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zeros, ones;
  for (int i = 0; i < str.size(); i++) {
      if (str[i] == '0') {
        if(!ones.empty()) {
          vector<int>& todo = ones.back();
          todo.push_back(i);
          zeros.push_back(todo);
          ones.pop_back();
        } else {
          vector<int> a(1, i);
          zeros.push_back(a);
        }
      } else {
        if(!zeros.empty()) {
          vector<int>& todo = zeros.back();
          todo.push_back(i);
          ones.push_back(todo);
          zeros.pop_back();
        } else {
          cout << "-1"; return 0;
        }

      }
  }

  if(!ones.empty()) {
    cout << "-1"; return 0;
  }

  cout << zeros.size() << endl;
  for(auto z : zeros) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zeros, ones;
  for (int i = 0; i < str.size(); i++) {
      if (str[i] == '0') {
        if(!ones.empty()) {
          ones.back().push_back(i);
          zeros.push_back(ones.back());
          ones.pop_back();
        } else {
          vector<int> a(1, i);
          zeros.push_back(a);
        }
      } else {
        if(!zeros.empty()) {
          zeros.back().push_back(i);
          ones.push_back(zeros.back());
          zeros.pop_back();
        } else {
          cout << "-1"; return 0;
        }

      }
  }
  if(!ones.empty()) {
    cout << "-1"; return 0;
  }

  cout << zeros.size() << endl;
  for(auto z : zeros) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zebra;
  for (int i = 0; i < str.size(); i++) {
      bool ok = false;
      if (str[i] == '0') {
        for(vector<int>& z : zebra) {
          if(str[z.back()] == '1') {
            z.push_back(i+1); ok = true;
          }
        }
        if(!ok) {
          vector<int> a(1, i+1);
          zebra.push_back(a);
        }
      } else {
        for(vector<int>& z : zebra) {
          if(str[z.back()] == '0') {
            z.push_back(i+1); ok = true;
            break;
          }
        }
        if(!ok) {
          cout << "-1"; return 0;
        }
      }
    // cout << zebra << endl << endl;
  }
  cout << zebra.size() << endl;
  for(auto z : zebra) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>
#include <chrono>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zeros, ones;
  for (int i = 0; i < str.size(); i++) {
      if (str[i] == '0') {
        if(!ones.empty()) {
          vector<int>& todo = ones.back();
          todo.push_back(i);
          ones.pop_back();
          zeros.push_back(todo);
        } else {
          vector<int> a(1, i);
          zeros.push_back(a);
        }
      } else {
        if(!zeros.empty()) {
          vector<int>& todo = zeros.back();
          todo.push_back(i);
          zeros.pop_back();
          ones.push_back(todo);
        } else {
          cout << "-1"; return 0;
        }

      }
  }

  if(!ones.empty()) {
    cout << "-1"; return 0;
  }

  cout << zeros.size() << endl;
  for(auto z : zeros) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>
#include <chrono>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zeros, ones;
  for (int i = 0; i < str.size(); i++) {
      if (str[i] == '0') {
        if(!ones.empty()) {
          vector<int>& todo = ones.back();
          todo.push_back(i);
          zeros.push_back(move(todo));
          ones.pop_back();
        } else {
          vector<int> a(1, i);
          zeros.push_back(a);
        }
      } else {
        if(!zeros.empty()) {
          vector<int>& todo = zeros.back();
          todo.push_back(i);
          ones.push_back(move(todo));
          zeros.pop_back();
        } else {
          cout << "-1"; return 0;
        }

      }
  }

  if(!ones.empty()) {
    cout << "-1"; return 0;
  }

  cout << zeros.size() << endl;
  for(auto z : zeros) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zebra;
  for (int i = 0; i < str.size(); i++) {
      bool ok = false;
      if (str[i] == '0') {
        for(vector<int>& z : zebra) {
          if(str[z.back()] == '1') {
            z.push_back(i); ok = true;
          }
        }
        if(!ok) {
          vector<int> a(1, i);
          zebra.push_back(a);
        }
      } else {
        for(vector<int>& z : zebra) {
          if(str[z.back()] == '0') {
            z.push_back(i); ok = true;
            break;
          }
        }
        if(!ok) {
          cout << "-1"; return 0;
        }
      }
    // cout << zebra << endl << endl;
  }
  cout << zebra.size() << endl;
  for(auto z : zebra) {
    cout << z.size() << " ";
    for(auto aux: z) {
      cout << aux+1 << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include <map>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <algorithm>
#include <math.h>
#include <set>
#include <sstream>
#include <iterator>
#include <bits/stdc++.h>

using namespace std;
template <typename T>
ostream& operator<< (ostream& out, const vector<T>& v) {
  if ( !v.empty() ) {
    out << '[';
    copy (v.begin(), v.end(), ostream_iterator<T>(out, ", "));
    out << "\b\b]";
  }
  return out;
}
template <typename T>
ostream& operator<< (ostream& out, const vector<vector<T>>& v) {
  for(vector<T> vaux:v) {
    cout << vaux << endl;
  }
  return out;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  string str;
  cin >> str;

  vector<vector<int>> zebra;
  for (int i = 0; i < str.size(); i++) {
      bool ok = false;
      if (str[i] == '0') {
        for(vector<int>& z : zebra) {
          if(z.back() == 1) {
            z.push_back(0); ok = true;
          }
        }
        if(!ok) {
          vector<int> a(1, 0);
          zebra.push_back(a);
        }
      } else {
        for(vector<int>& z : zebra) {
          if(z.back() == 0) {
            z.push_back(1); ok = true;
            break;
          }
        }
        if(!ok) {
          cout << "-1"; return 0;
        }
      }
    // cout << zebra << endl << endl;
  }
  cout << zebra.size() << endl;
  for(auto z : zebra) {
    for(auto aux: z) {
      cout << aux << " ";
    }
    cout << endl;
  }
  return 0;
}


#include <iostream>
#include<cstring>
#include <vector>

using namespace std;
const int N = 200002;
char s[N];

vector <int> ans[N];

int main() {

    scanf("%s", s+1);
    int len = strlen(s+1);
    int zlp = 0;
    int olp = 0;

    for (int i = 1; i <= len; i++){
        if(s[i] == '0'){
            ans[++zlp].push_back(i);
        }else{
            if(!zlp){
                cout << -1 << endl;
            }
            ans[zlp--].push_back(i);
        }
        olp = max(zlp,olp);
    }
    if (zlp != olp){
        cout << -1 << endl;
        return 0;
    }
    cout << zlp << endl;
    for (int i = 1;i <= zlp; i++){
        cout << ans[i].size();
        for(int j = 0;j < ans[i].size(); j++){
            cout << ' ' << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


#include <iostream>
#include<cstring>
#include <vector>

using namespace std;
const int N = 200002;
char s[N];

vector <int> ans[N];

int main() {

    scanf("%s", s+1);
    int len = strlen(s+1);
    int zlp = 0;
    int olp = 0;

    int count =0;

    for (int i = 1; i <= len; i++){
        if(s[i] == '0'){
            ans[++zlp].push_back(i);
        }else{
            if(!zlp){
                cout << -1 << endl;
            }
            ans[zlp--].push_back(i);
        }
        olp = max(zlp,olp);
    }
    if (zlp != olp){
        cout << -1 << endl;
        return 0;
    }
    cout << count << endl;
    for (int i = 1;i <= zlp; i++){
        cout << ans[i].size()-1;
        for(int j = 0;j < ans[i].size(); j++){
            cout << ' ' << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


#include <iostream>
#include<cstring>
#include <vector>

using namespace std;
const int N = 200002;
char s[N];

vector <int> ans[N];

int main() {

    scanf("%s", s+1);
    int len = strlen(s+1);
    int zlp = 0;
    int olp = 0;

    for (int i = 1; i <= len; i++){
        if(s[i] == '0'){
            ans[++zlp].push_back(i);
        }else{
            if(!zlp){
                cout << -1 << endl;
                return 0;
            }
            ans[zlp--].push_back(i);
        }
        olp = max(zlp,olp);
    }
    if (zlp != olp){
        cout << -1 << endl;
        return 0;
    }
    cout << zlp << endl;
    for (int i = 1;i <= zlp; i++){
        cout << ans[i].size();
        for(int j = 0;j < ans[i].size(); j++){
            cout << ' ' << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int N = 200002;
char s[N];

vector<vector <int>> ans(N);

int main() {

    scanf("%s", s+1);
    int len = strlen(s+1);

    int count =0;

    for (int i = 1; i <= len; i++){
        if(s[i] == '0'){
            int flag = 0;
            if(count){
                for(int j = 0;j < count;j++){
                    if(ans[j].back() == -1){
                        ans[j].pop_back();
                        ans[j].push_back(i);
                        ans[j].push_back(0);
                        flag = 1;
                        break;
                    }
                }
            }
            if (!(count && flag)){
                ans[count].push_back(i);
                ans[count].push_back(0);
                count++;
            }
        }else{
            int flag = 0;
            if(count){
                for(int j = 0;j < count;j++){
                    if(ans[j].back() == 0){
                        ans[j].pop_back();
                        ans[j].push_back(i);
                        ans[j].push_back(-1);
                        flag = 1;
                        break;
                    }
                }
            }
            if (!(count && flag)){
                cout << -1 <<endl;
                return 0;
            }
        }
    }
    for (int i = 0;i < count; i++){
        if (ans[i].back() == -1){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << count << endl;
    for (int i = 0;i < count; i++){
        cout << ans[i].size()-1;
        for(int j = 0;j < ans[i].size()-1; j++){
            cout << ' ' << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int N = 200002;
char s[N];

queue<int> indices;
//vector<int> ans[200001];

int q0[N];
int q1[N];
int ans[N];
int len;
int q0count = 0;
int q1count = 0;
int q0p,ansp;

int main() {

    scanf("%s", s+1);
    len = strlen(s+1);
    for (int i = 1; i <= len; i++){
        if (s[i] == '1') {
            if((q0count == 0)||(i==len)){
                cout << -1 << endl;
                return 0;
            }else{
                q1count ++;
                if (q1count > q0count) {
                    cout << -1 << endl;
                    return 0;
                }
                q1[q1count] = i;
            }
        }else{
            q0count++;
            q0[q0count] = i;
        }
    }
    q0p = 1;
    ansp = 0;
    ans[0] = 0;

    for (;q0p <= q0count;q0p++){
        if(!q0[q0p]) continue;
        ans[++ansp] = q0[q0p];
        int j = 1;
        int i = q0p +1;
        while(true){
            int flag = 0;
            for (;j <= q1count; j++){
                if (q1[j] > ans[ansp]){
                    ans[++ansp] =  q1[j];
                    q1[j] = 0;
                    flag = 1;
                    break;
                }
            }
            if (!flag){
                indices.push(ansp);
                ans[0]++;
                break;
            }
            for (; i <= q0count; i++){
                if (q0[i] > ans[ansp]){
                    ans[++ansp] =  q0[i];
                    q0[i] = 0;
                    flag = 1;
                    break;
                }
            }
            if(!flag){
                cout << -1 <<endl;
            }
        }
    }

    cout << ans[0] << endl;
    int i = 1,last = 0;
    while(!indices.empty()){
        cout << indices.front()-last;
        for (;i <= indices.front();i++){
            cout << ' ' << ans[i];
        }
        cout << endl;
        last = indices.front();
        indices.pop();
    }

    return 0;
}


#include <bits/stdc++.h>

using namespace std;
const int N = 200002;
char s[N];

vector<vector <int>> ans(N);

int main() {

    scanf("%s", s+1);
    int len = strlen(s+1);
    int olc = 0;

    int count =0;

    for (int i = 1; i <= len; i++){
        if(s[i] == '0'){
            int flag = 0;
            if(count){
                for(int j = 0;j < count;j++){
                    if(ans[j].back() == -1){
                        ans[j].pop_back();
                        ans[j].push_back(i);
                        ans[j].push_back(0);
                        olc--;
                        flag = 1;
                        break;
                    }
                }
            }
            if (!(count && flag)){
                ans[count].push_back(i);
                ans[count].push_back(0);
                count++;
            }
        }else{
            int flag = 0;
            if(count){
                for(int j = 0;j < count;j++){
                    if(ans[j].back() == 0){
                        ans[j].pop_back();
                        ans[j].push_back(i);
                        ans[j].push_back(-1);
                        flag = 1;
                        olc++;
                        break;
                    }
                }
            }
            if (!(count && flag)){
                cout << -1 <<endl;
                return 0;
            }
        }
    }
    if (olc){
        cout << -1 << endl;
        return 0;
    }
    cout << count << endl;
    for (int i = 0;i < count; i++){
        cout << ans[i].size()-1;
        for(int j = 0;j < ans[i].size()-1; j++){
            cout << ' ' << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


#include <iostream>
#include <vector>

using namespace std;
const int N = 200002;
char s[N];

vector<vector <int>> ans(N);

int main() {

    scanf("%s", s+1);
    int len = strlen(s+1);

    int count =0;

    for (int i = 1; i <= len; i++){
        if(s[i] == '0'){
            int flag = 0;
            if(count){
                for(int j = 0;j < count;j++){
                    if(ans[j].back() == -1){
                        ans[j].pop_back();
                        ans[j].push_back(i);
                        ans[j].push_back(0);
                        flag = 1;
                        break;
                    }
                }
            }
            if (!(count && flag)){
                ans[count].push_back(i);
                ans[count].push_back(0);
                count++;
            }
        }else{
            int flag = 0;
            if(count){
                for(int j = 0;j < count;j++){
                    if(ans[j].back() == 0){
                        ans[j].pop_back();
                        ans[j].push_back(i);
                        ans[j].push_back(-1);
                        flag = 1;
                        break;
                    }
                }
            }
            if (!(count && flag)){
                cout << -1 <<endl;
                return 0;
            }
        }
    }
    for (int i = 0;i < count; i++){
        if (ans[i].back() == -1){
            cout << -1 << endl;
            return 0;
        }
    }
    cout << count << endl;
    for (int i = 0;i < count; i++){
        cout << ans[i].size()-1;
        for(int j = 0;j < ans[i].size()-1; j++){
            cout << ' ' << ans[i][j];
        }
        cout << endl;
    }

    return 0;
}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0,num1=0;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		if(s[i]=='1') num1++;
		v.push_back({s[i-1],i});
	}
	if(num1){
			while(!v.empty()){
			check = 48;
			ans = false;
			for(it=v.begin();it!=v.end();++it){
				if(it->first==check){
					if(check=='1') num1--;
					ans = true;
					a[count].push_back(it->second);
					v.erase(it);
					it--;
					check = (check+1)%2+48;
					k++;
				}
				back = v.end();
				back--;
				if(back->first==49){
					ans = false;
					break;
				}
			}
			if(!ans){
				break;
			}
			size[count] = k;
			k=0;
			count++;
		}
		if(ans){
			printf("%d\n",count);
			for(i=0;i<count;++i){
				printf("%d ",size[i]);
				for(ita=a[i].begin();ita!=a[i].end();++ita){
					printf("%d ",*ita);
				}
				printf("\n");
			}
		}
		else{
			printf("-1");
		}
	}
	else
	{
		printf("%d\n",s.size());
		for(i=1;i<=s.size();++i){
			printf("1 %d\n",i);
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		v.push_back({s[i-1],i});
	}
	while(!v.empty()){
		check = 48;
		ans = false;
		for(it=v.begin();it!=v.end();++it){
			if(it->first==check){
				ans = true;
				a[count].push_back(it->second);
				v.erase(it);
				it--;
				check = (check+1)%2+48;
				k++;
			}
			back = v.end();
			back--;
			if(back->first==49){
				ans = false;
				break;
			}
		}
		if(!ans){
			break;
		}
		size[count] = k;
		count++;
	}
	if(ans){
		printf("%d\n",count);
		for(i=0;i<count;++i){
			printf("%d ",size[i]);
			for(ita=a[i].begin();ita!=a[i].end();++ita){
				printf("%d ",*ita);
			}
			printf("\n");
		}
	}
	else{
		printf("-1");
	}
}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0,num1=0,m;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		if(s[i]=='1') {num1++;}
		v.push_back({s[i-1],i});
	}
	if(num1){
			while(!v.empty()){
			if(!num1) break;
			check = 48;
			ans = false;
			for(it=v.begin();it!=v.end();++it){
				if(it->first==check){
					if(check=='1') num1--;
					ans = true;
					a[count].push_back(it->second);
					v.erase(it);
					it--;
					check = (check+1)%2+48;
					k++;
				}
				back = v.end();
				back--;
				if(back->first==49){
					ans = false;
					break;
				}
			}
			if(!ans){
				break;
			}
			size[count] = k;
			k=0;
			count++;
		}
		if(ans){
			printf("%d\n",count);
			for(i=0;i<count;++i){
				printf("%d ",size[i]);
				for(ita=a[i].begin();ita!=a[i].end();++ita){
					printf("%d ",*ita);
				}
				printf("\n");
			}
			while(!v.empty()){
				it = v.begin();
				printf("1 %d\n",it->second);
				v.erase(v.begin());
			}
		}
		else{
			printf("-1");
		}
	}
	else
	{
		printf("%d\n",s.size());
		for(i=1;i<=s.size();++i){
			printf("1 %d\n",i);
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0,num1=0,m;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		if(s[i-1]=='1') {num1++;}
		v.push_back({s[i-1],i});
	}
	if(num1){
			while(!v.empty()){
			check = 48;
			ans = false;
			for(it=v.begin();it!=v.end();++it){
				if(it->first==check){
					if(check=='1') num1--;
					ans = true;
					a[count].push_back(it->second);
					v.erase(it);
					it--;
					check = (check+1)%2+48;
					k++;
				}
				back = v.end();
				back--;
				if(back->first==49){
					ans = false;
					break;
				}
			}
			if(!ans){
				break;
			}
			size[count] = k;
			k=0;
			count++;
		}
		if(ans){
			printf("%d\n",count);
			for(i=0;i<count;++i){
				printf("%d ",size[i]);
				for(ita=a[i].begin();ita!=a[i].end();++ita){
					printf("%d ",*ita);
				}
				printf("\n");
			}
			while(!v.empty()){
				it = v.begin();
				printf("1 %d\n",it->second);
				v.erase(v.begin());
			}
		}
		else{
			printf("-1");
		}
	}
	else
	{
		if(num1==s.size()){
			printf("-1");
		}
		else{
			printf("%d\n",s.size());
			for(i=1;i<=s.size();++i){
				printf("1 %d\n",i);
			}
		}

	}

}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0,num1=0;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		if(s[i]=='1') num1++;
		v.push_back({s[i-1],i});
	}
	if(num1){
			while(!v.empty()){
			if(!num1) break;
			check = 48;
			ans = false;
			for(it=v.begin();it!=v.end();++it){
				if(it->first==check){
					if(check=='1') num1--;
					ans = true;
					a[count].push_back(it->second);
					v.erase(it);
					it--;
					check = (check+1)%2+48;
					k++;
				}
				back = v.end();
				back--;
				if(back->first==49){
					ans = false;
					break;
				}
			}
			if(!ans){
				break;
			}
			size[count] = k;
			k=0;
			count++;
		}
		if(ans){
			printf("%d\n",count);
			for(i=0;i<count;++i){
				printf("%d ",size[i]);
				for(ita=a[i].begin();ita!=a[i].end();++ita){
					printf("%d ",*ita);
				}
				printf("\n");
			}
		}
		else{
			printf("-1");
		}
	}
	else
	{
		printf("%d\n",s.size());
		for(i=1;i<=s.size();++i){
			printf("1 %d\n",i);
		}
	}

}


#include<bits/stdc++.h>
using namespace std;
main()
{
    string s;
    cin >> s;
    s = " "+s;
    int i,l = s.size(),n0=0,n1=0,num=0;
    map <int,vector<int> > ma;
    map <int,vector<int> > :: iterator it;
    vector<int> :: iterator itv;
    for(i=1;i<s.size();++i){
        if(s[i]%2==0){
            n0++;
            if(num<n0) {num = n0;}
            ma[n0].push_back(i);
            if(n1>0){ n1--; }
        }
        else{
            n1++;
            ma[n0].push_back(i);
            n0--;
            if(n0<0) {printf("-1"); return 0;}
        }
    }
    if(n1) {printf("-1"); return 0;}
    printf("%d\n",num);
    for(it=ma.begin();it!=ma.end();++it){
        printf("%d ",it->second.size());
        for(itv=it->second.begin();itv!=it->second.end();++itv){
            printf("%d ",*itv);
        }
        printf("\n");
    }
}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		v.push_back({s[i-1],i});
	}
	while(!v.empty()){
		check = 48;
		ans = false;
		for(it=v.begin();it!=v.end();++it){
			if(it->first==check){
				ans = true;
				a[count].push_back(it->second);
				v.erase(it);
				it--;
				check = (check+1)%2+48;
				k++;
			}
			back = v.end();
			back--;
			if(back->first==49){
				ans = false;
				break;
			}
		}
		if(!ans){
			break;
		}
		size[count] = k;
		k=0;
		count++;
	}
	if(ans){
		printf("%d\n",count);
		for(i=0;i<count;++i){
			printf("%d ",size[i]);
			for(ita=a[i].begin();ita!=a[i].end();++ita){
				printf("%d ",*ita);
			}
			printf("\n");
		}
	}
	else{
		printf("-1");
	}
}


#include<bits/stdc++.h>
using namespace std;
main()
{
	string s;
	cin >> s;
	int i,k=0,check=48,count=0,num1=0,m;
	bool ans=false;
	vector <pair<char,int> > v;
	vector <pair<char,int> > :: iterator it,back;
	vector <int> a[s.size()];
	vector <int> :: iterator ita;
	int size[200001]={0};
	for(i=1;i<=s.size();++i){
		if(s[i-1]=='1') {num1++;}
		v.push_back({s[i-1],i});
	}
	if(num1){
			while(!v.empty()){
			if(!num1) break;
			check = 48;
			ans = false;
			for(it=v.begin();it!=v.end();++it){
				if(it->first==check){
					if(check=='1') num1--;
					ans = true;
					a[count].push_back(it->second);
					v.erase(it);
					it--;
					check = (check+1)%2+48;
					k++;
				}
				back = v.end();
				back--;
				if(back->first==49){
					ans = false;
					break;
				}
			}
			if(!ans){
				break;
			}
			size[count] = k;
			k=0;
			count++;
		}
		if(ans){
			printf("%d\n",count);
			for(i=0;i<count;++i){
				printf("%d ",size[i]);
				for(ita=a[i].begin();ita!=a[i].end();++ita){
					printf("%d ",*ita);
				}
				printf("\n");
			}
			while(!v.empty()){
				it = v.begin();
				printf("1 %d\n",it->second);
				v.erase(v.begin());
			}
		}
		else{
			printf("-1");
		}
	}
	else
	{
		if(num1==s.size()){
			printf("-1");
		}
		else{
			printf("%d\n",s.size());
			for(i=1;i<=s.size();++i){
				printf("1 %d\n",i);
			}
		}

	}

}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vi ans[N];
vi cur;
vi xtra;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    bool zero;
    int idex=0;
    F0R(i,sz(S))cur.pb(i);
    while(sz(cur)!=0)
    {
        zero=1;
        xtra.clear();
        F0R(i,sz(cur))
        {
            if((zero&&S[cur[i]]=='0')||(!zero&&S[cur[i]]=='1'))
            {
                ans[idex].pb(cur[i]+1);
                zero=!zero;
            }
            else
            {
                xtra.pb(cur[i]);
            }
        }
        if(sz(ans[idex])==0)
        {
            cout<<-1<<endl;
            return 0;
        }
        idex++;
        cur=xtra;
    }
    cout<<idex<<endl;
    F0R(i,idex)
    {
        cout<<sz(ans[i])<<' ';
        trav(e,ans[i])cout<<e<<' ';
        cout<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vi ans[N];
vi cur;
vi xtra;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    bool zero;
    int idex=0;
    F0R(i,sz(S))cur.pb(i);
    int ok=0;
    R0F(i,sz(S))
    {
        if(S[i]=='0')++ok;
        else --ok;
        if(ok<0)
        {
            cout<<-1<<'\n';
            return 0;
        }
    }
    while(sz(cur)!=0)
    {
        zero=1;
        xtra.clear();
        F0R(i,sz(cur))
        {
            if((zero&&S[cur[i]]=='0')||(!zero&&S[cur[i]]=='1'))
            {
                ans[idex].pb(cur[i]+1);
                zero=!zero;
            }
            else
            {
                xtra.pb(cur[i]);
            }
        }
        cur=xtra;
        if(sz(ans[idex])==1)
        {
            F0R(i,sz(cur))
            {
                ++idex;
                ans[idex].pb(cur[i]+1);
            }
            cur={};
        }
        idex++;
    }
    cout<<idex<<'\n';
    F0R(i,idex)
    {
        cout<<sz(ans[i])<<' ';
        trav(e,ans[i])cout<<e<<' ';
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vi ans[N];
vi cur;
vi xtra;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    bool zero;
    int idex=0;
    F0R(i,sz(S))cur.pb(i);
    int ok=0;
    R0F(i,sz(S))
    {
        if(S[i]=='0')++ok;
        else --ok;
        if(ok<0)
        {
            cout<<-1<<'\n';
            return 0;
        }
    }
    while(sz(cur)!=0)
    {
        zero=1;
        xtra.clear();
        F0R(i,sz(cur))
        {
            if((zero&&S[cur[i]]=='0')||(!zero&&S[cur[i]]=='1'))
            {
                ans[idex].pb(cur[i]+1);
                zero=!zero;
            }
            else
            {
                xtra.pb(cur[i]);
            }
        }
        if(sz(ans[idex])==0)
        {
            cout<<-1<<'\n';
            return 0;
        }
        idex++;
        cur=xtra;
    }
    cout<<idex<<'\n';
    F0R(i,idex)
    {
        cout<<sz(ans[i])<<' ';
        trav(e,ans[i])cout<<e<<' ';
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vector<vi> ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    int open=-1;
    int fresh=0;
    F0R(i,sz(S))
    {
        if(S[i]=='0')
        {
            if(open!=-1)
            {
                ans[open].pb(i+1);
                --open;
                continue;
            }
            else
            {
                ans.pb({i+1});
                ++fresh;
                continue;
            }
        }
        else
        {
            if(open!=fresh-1)
            {
                ans[open+1].pb(i+1);
                ++open;
                continue;
            }
            else
            {
                cout<<-1<<'\n';
                return 0;
            }
        }
    }
    if(open!=-1)
    {
        cout<<-1<<'\n';
        return 0;
    }
    cout<<sz(ans)<<'\n';
    trav(e,ans)
    {
        cout<<sz(e)<<' ';
        trav(e1,e)
        {
            cout<<e1<<' ';
        }
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vi ans[N];
vi cur;
vi xtra;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    bool zero;
    int idex=0;
    F0R(i,sz(S))cur.pb(i);
    int ok=0;
    R0F(i,sz(S))
    {
        if(S[i]=='0')++ok;
        else --ok;
        if(ok<0)
        {
            cout<<-1<<'\n';
            return 0;
        }
    }
    while(sz(cur)!=0)
    {
        zero=1;
        xtra.clear();
        F0R(i,sz(cur))
        {
            if((zero&&S[cur[i]]=='0')||(!zero&&S[cur[i]]=='1'))
            {
                ans[idex].pb(cur[i]+1);
                zero=!zero;
            }
            else
            {
                xtra.pb(cur[i]);
            }
        }
        idex++;
        cur=xtra;
        if(sz(ans[idex])==1)
        {
            F0R(i,sz(cur))
            {
                ans[idex].pb(cur[i]+1);
                ++idex;
            }
            cur={};
        }
    }
    cout<<idex<<'\n';
    F0R(i,idex)
    {
        cout<<sz(ans[i])<<' ';
        trav(e,ans[i])cout<<e<<' ';
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vi ans[N];
vi cur;
vi xtra;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    bool zero;
    int idex=0;
    F0R(i,sz(S))cur.pb(i);
    int ok=0;
    R0F(i,sz(S))
    {
        if(S[i]=='0')++ok;
        else --ok;
        if(ok<0)
        {
            cout<<-1<<'\n';
            return 0;
        }
    }
    while(sz(cur)!=0)
    {
        zero=1;
        xtra.clear();
        F0R(i,sz(cur))
        {
            if((zero&&S[cur[i]]=='0')||(!zero&&S[cur[i]]=='1'))
            {
                ans[idex].pb(cur[i]+1);
                zero=!zero;
            }
            else
            {
                xtra.pb(cur[i]);
            }
        }
        if(sz(ans[idex])==0)
        {
            cout<<-1<<'\n';
            return 0;
        }
        if(zero)
        {
            xtra.insert(xtra.end()-2, ans[idex].back());
            ans[idex].pop_back();
        }
        idex++;
        cur=xtra;
    }
    cout<<idex<<'\n';
    F0R(i,idex)
    {
        cout<<sz(ans[i])<<' ';
        trav(e,ans[i])cout<<e<<' ';
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vi ans[N];
vi cur;
vi xtra;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    bool zero;
    int idex=0;
    F0R(i,sz(S))cur.pb(i);
    int ok=0;
    R0F(i,sz(S))
    {
        if(S[i]=='0')++ok;
        else --ok;
        if(ok<0)
        {
            cout<<-1<<endl;
            return 0;
        }
    }
    while(sz(cur)!=0)
    {
        zero=1;
        xtra.clear();
        F0R(i,sz(cur))
        {
            if((zero&&S[cur[i]]=='0')||(!zero&&S[cur[i]]=='1'))
            {
                ans[idex].pb(cur[i]+1);
                zero=!zero;
            }
            else
            {
                xtra.pb(cur[i]);
            }
        }
        if(sz(ans[idex])==0)
        {
            cout<<-1<<endl;
            return 0;
        }
        if(zero)
        {
            xtra.insert(xtra.end()-2, ans[idex].back());
            ans[idex].pop_back();
        }
        idex++;
        cur=xtra;
    }
    cout<<idex<<endl;
    F0R(i,idex)
    {
        cout<<sz(ans[i])<<' ';
        trav(e,ans[i])cout<<e<<' ';
        cout<<endl;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
vector<vi> ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    int open=-1;
    int fresh=0;
    F0R(i,sz(S))
    {
        if(S[i]=='0')
        {
            if(open!=-1)
            {
                ans[open].pb(i+1);
                --open;
            }
            else
            {
                ans.pb({i+1});
                ++fresh;
            }
        }
        else
        {
            if(open!=fresh-1)
            {
                ans[open+1].pb(i+1);
                ++open;
            }
            else
            {
                cout<<-1<<'\n';
                return 0;
            }
        }
    }
    if(open!=-1)
    {
        cout<<-1<<'\n';
        return 0;
    }
    cout<<sz(ans)<<'\n';
    trav(e,ans)
    {
        cout<<sz(e)<<' ';
        trav(e1,e)
        {
            cout<<e1<<' ';
        }
        cout<<'\n';
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define f first
#define s second

string S;
int const N=2e5+3;
vector<vi> ans;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>S;
    int open=-1;
    int fresh=0;
    F0R(i,sz(S))
    {
        if(S[i]=='0')
        {
            if(open!=-1)
            {
                ans[open].pb(i+1);
                --open;
                continue;
            }
            else
            {
                ans.pb(vi (1,i+1));
                ++fresh;
                continue;
            }
        }
        else
        {
            if(open!=fresh-1)
            {
                ans[open+1].pb(i+1);
                ++open;
                continue;
            }
            else
            {
                cout<<-1<<endl;
                return 0;
            }
        }
    }
    if(open!=-1)
    {
        cout<<-1<<endl;
        return 0;
    }
    cout<<sz(ans)<<endl;
    trav(e,ans)
    {
        cout<<sz(e)<<' ';
        trav(e1,e)
        {
            cout<<e1<<' ';
        }
        cout<<endl;
    }
    return 0;
}


#include <iostream>
#include <algorithm>
using namespace std;
main()
{
	int i,j,k,n,m;
	int A[100000];

	cin >> n;
	for (i=0; i<n; i++) cin >> A[i];

	sort(A,A+n);

	j=0;
	for (i=0; i<n; i++)
	{
		j+=(A[i]*A[n-1-i]);
		j%=10007;
	}

	cout << j;

}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;

const int INF = 1000001000;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
}

int main() {
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector <int> a(n);
    cin >> a;
    sort(a.begin(), a.end());
    ll ans = 0;
    for (int i = 0, j = n - 1; i < n; i++, j--)
        ans = (ans + ((1ll * a[i] * a[j]) % 10007ll));
    cout << ans % 10007 << endl;
    return 0;
}


#include <cstdio>
#include <deque>
#include <iostream>
#include <iomanip>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <ctime>
#include <algorithm>
#include <cmath>

#define pb push_back
#define mp make_pair
#define F first
#define S second

#ifndef LOCAL
#define cerr if(0)cerr
#endif // LOCAL

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long double ld;

const int INF = 1000001000;
const long long INFll = 1ll * INF * INF;
const long double ldINF = 1e+018;
const long double EPS = 0.000000001;
const int sdx[4] = {-1, 0, 1, 0};
const int sdy[4] = {0, 1, 0, -1};

template<typename T>
ostream& operator<<(ostream& out, pair<T, T>& a) {
    out << a.F << " " << a.S;
    return out;
}

template<typename T>
istream& operator>>(istream& in, pair<T, T>& a) {
    in >> a.F >> a.S;
    return in;
}

template<typename T>
istream& operator>>(istream& in, vector<T>& a) {
    for (int i = 0; i < a.size(); ++i)
        in >> a[i];
    return in;
}

template<typename T>
ostream& operator<<(ostream& out, vector<T> a) {
    for (int i = 0; i < a.size(); ++i)
        if (i == a.size() - 1)
            out << a[i];
        else
            out << a[i] << " ";
}

int main() {
    ios_base::sync_with_stdio(0);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n;
    cin >> n;
    vector <int> a(n);
    cin >> a;
    sort(a.begin(), a.end());
    ll ans = 0;
    for (int i = 0, j = n - 1; i < n; i++, j--)
        ans += ((1ll * a[i] * a[j]) % 10007);
    cout << ans << endl;
    return 0;
}