#include<bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define ri register
#define For(iee,eei,eie) for(iee=eei;iee<=eie;iee++)
using namespace std;
template <class T>
inline void read(T &x) {
x=0;
ri char c = getchar();
for (; !isdigit(c); c = getchar());
for (; isdigit(c); c = getchar()) x = x * 10 + (c ^ 48);
}
string a;
ll n,ans,top;
int main()
{
ll i;
cin>>a;
n=a.size();
for(i=0;i<n;i++)
a[n+i]=a[n-i-1];
for(i=0;i<n;i++)
a[i]=a[n+i];
while(top<n-1)
{
ans++;
if(a[top]=='1')
{
for(i=top;a[i]=='1';i++)
a[i]='0';
if(i==n)n++;
a[i]='1';
}
else top++;
}
if(a[top]=='0')ans++;
cout<<ans;
return 0;
}
数据:1010101001001111000111110011111000010101011111101010