S = eval(input())



out1, out2 = 0, 0

for i, j in enumerate(S):

  xor = int(j) ^ (i % 2)

  out1 += xor

  out2 += (1 - xor)

  

print((min(out1, out2)))
S = eval(input())



out1 = out2 = 0

for i, j in enumerate(S):

  xor = (j == '1') ^ (i % 2)

  out1 += xor

  out2 += (1 - xor)



print((out1 if out1 < out2 else out2))
S = eval(input())
out1, out2 = 0, 0
for i, j in enumerate(S):
    xor = int(j) ^ (i % 2)
    out1 += xor
    out2 += 1 - xor
print((min(out1, out2)))

S = eval(input())
out1 = out2 = 0
for i, j in enumerate(S):
    xor = (j == "1") ^ (i % 2)
    out1 += xor
    out2 += 1 - xor
print((out1 if out1 < out2 else out2))

-out1, out2 = 0, 0 +out1 = out2 = 0 -    xor = int(j) ^ (i % 2) +    xor = (j == "1") ^ (i % 2) -print((min(out1, out2))) +print((out1 if out1 < out2 else out2))