s=eval(input())

b=l=r=0

for i in s:

  l+=(int(i)==b)

  r+=(int(i)!=b)

  b^=1

print((min(l,r)))
s=eval(input())

b=c=0

for i in s:

  c+=(int(i)==b)

  b^=1

print((min(c,len(s)-c)))
s = eval(input())
b = l = r = 0
for i in s:
    l += int(i) == b
    r += int(i) != b
    b ^= 1
print((min(l, r)))

s = eval(input())
b = c = 0
for i in s:
    c += int(i) == b
    b ^= 1
print((min(c, len(s) - c)))

-b = l = r = 0 +b = c = 0 -    l += int(i) == b -    r += int(i) != b +    c += int(i) == b -print((min(l, r))) +print((min(c, len(s) - c)))