scanf("%s", S + 1); N = strlen(S + 1); for (int i = 1; i <= N; ++i) { int x = S[i] - '0'; if (!x) { S1.push((node){x, i}); if (S2.empty()) continue; int tmp = S2.top().y; S2.pop(); Next[tmp] = i; } else { if (S1.empty()) { cout<<-1<<endl; return0; } S2.push((node){x, i}); int tmp = S1.top().y; S1.pop(); Next[tmp] = i; } }
if (!S2.empty()) { cout<<-1<<endl; return0; }
int Ans = 0; for (int i = 1; i <= N; ++i) { if (Vis[i]) continue; ++Ans; int cnt = 0, tmp = i; while (tmp) { Vis[tmp] = 1; tmp = Next[tmp]; } } cout<<Ans<<endl;
memset (Vis, 0, sizeof (Vis)); for (int i = 1; i <= N; ++i) { if (Vis[i]) continue; int cnt = 0, tmp = i; while (tmp) cnt ++, tmp = Next[tmp]; cout<<cnt<<" "; tmp = i; while (tmp) { cout<<tmp<<" "; Vis[tmp] = 1; tmp = Next[tmp]; } cout<<endl; } return0; }