#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>

using namespace std;

string s;
bool sve0i1;
int pref[100005];
int minR = 2e9;
int duzina,a,b;

int main()
{
    cin>>s;
    duzina = s.size();
    sve0i1 = true;
    for(int i=0;i<duzina;i++)
        if(s[i]>'1')
            sve0i1 = false;
    if(sve0i1)
    {
        pref[0]=s[0]-'0';
        for(int i=1;i<duzina;i++)
        {
            pref[i]=pref[i-1]+s[i]-'0';
        }
        for(int i=0;i<duzina;i++)
        {
            a=i+1-pref[i];
            b=pref[duzina-1]-pref[i];
            minR = min(minR,a + b);
            cout<<a<<" "<<b<<" "<<minR<<endl;
            a=pref[i];
            b=(duzina-i-1)-(pref[duzina-1]-pref[i]);
            minR = min(minR,a + b);
            cout<<a<<" "<<b<<" "<<minR<<endl<<endl;
        }
        cout<<minR<<endl;
    }

    return 0;
}
///  01001o10101001