用计数的思想做的
#include<bits/stdc++.h>
using namespace std;
int main(){
string s,s1="";
int n,l=0,y=0,h=0,a[2000]={0};
while(cin>>s){
n=s.size();
s1=s1+s;
}
s1=s1+"a";
int n1=s1.size();
for(int i=0;i<n1;){
while(s1[i]=='0'){
l++;
i++;
}
a[h]=l;
l=0;
h=h+1;
if(s1[i]=='a'){
break;
}
while(s1[i]=='1'){
y++;
i++;
}
a[h]=y;
y=0;
h=h+1;
if(s1[i]=='a'){
break;
}
}
cout<<n<<" ";
for(int i=0;i<h;i++){
cout<<a[i]<<" ";
}
return 0;
}