import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        String s = new Scanner(System.in).nextLine();
        s = s + s;
        int p = 0, q = 0, cnt = 0;
        while (p < s.length()) {
            if(s.charAt(p) == '1'){
                q = p;
                while (q < s.length() && s.charAt(q) == '1') {
                    q++;
                }
                cnt = Math.max(cnt, q - p);
                p = q;
            }else{
                p++;
            }
        }
        System.out.println(Math.min(cnt, s.length() / 2));
    }
}