#include <iostream>
using namespace std;
int main(){
int maxsec=0, sec=0, ante=1;
long n;
//Citim numarul
cin >> n;
//Prelucram cifrele
while(n){
if(n%2==1 || n%10<ante){
if(sec>maxsec) maxsec=sec;
sec=0;
}
else sec++;
ante = n%10;
n=n/10;
}
//Afisare rezultat
cout << maxsec;
}