#include<iostream>
#include<cmath>
using namespace std;
int a[40010];
char b[40010];
int main(void)
{
int i=1;
while(cin>>b[i])
{
if(b[i]!='0'&&b[i]!='1')
{
break;
}
a[i]=b[i]-'0';
++i;
}
cout<<sqrt(i-1)<<" ";
a[i]=2;
bool c=false;
int count=0;
for (int j=1;j<=i; )
{
if(a[j]==c)
{
count+=1;
++j;
}
else if(a[j]==!c)
{
cout<<count<<" ";
count=0;
c=!c;
}
else
{
cout<<count<<" ";
return 0;
}
}
}
请大家给我讲解一下