S=eval(input())

N=len(S)

A="".join([str(i%2) for i in range(N)])

B="".join([str((i+1)%2) for i in range(N)])

print((min(sum([1 for i in range(N) if S[i]!=A[i]]),sum([1 for i in range(N) if S[i]!=B[i]]))))
S=eval(input())

N=len(S)

A=len([i for i in range(N) if str(i%2)==S[i]])

print((min(A,N-A)))
S = eval(input())
N = len(S)
A = "".join([str(i % 2) for i in range(N)])
B = "".join([str((i + 1) % 2) for i in range(N)])
print(
    (
        min(
            sum([1 for i in range(N) if S[i] != A[i]]),
            sum([1 for i in range(N) if S[i] != B[i]]),
        )
    )
)

S = eval(input())
N = len(S)
A = len([i for i in range(N) if str(i % 2) == S[i]])
print((min(A, N - A)))

-A = "".join([str(i % 2) for i in range(N)]) -B = "".join([str((i + 1) % 2) for i in range(N)]) -print( -    ( -        min( -            sum([1 for i in range(N) if S[i] != A[i]]), -            sum([1 for i in range(N) if S[i] != B[i]]), -        ) -    ) -) +A = len([i for i in range(N) if str(i % 2) == S[i]]) +print((min(A, N - A)))