s = eval(input())

cnt = 0



for i in range(len(s)):

  if i%2 == 0:

    if s[i] == "0":

      cnt += 1

  else:

    if s[i] == "1":

      cnt += 1

      



print((min(cnt,len(s)-cnt)))
s = eval(input())

cnt = 0



t = "01"*(-((-1)*len(s)//2))



cnt_1 = 0

cnt_2 = 0



for i in range(len(s)):

    if s[i] == t[i]:

        cnt_1 += 1



    else:

        cnt_2 += 1



print((min(cnt_1,cnt_2)))
s = eval(input())
cnt = 0
for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "0":
            cnt += 1
    else:
        if s[i] == "1":
            cnt += 1
print((min(cnt, len(s) - cnt)))

s = eval(input())
cnt = 0
t = "01" * (-((-1) * len(s) // 2))
cnt_1 = 0
cnt_2 = 0
for i in range(len(s)):
    if s[i] == t[i]:
        cnt_1 += 1
    else:
        cnt_2 += 1
print((min(cnt_1, cnt_2)))

+t = "01" * (-((-1) * len(s) // 2)) +cnt_1 = 0 +cnt_2 = 0 -    if i % 2 == 0: -        if s[i] == "0": -            cnt += 1 +    if s[i] == t[i]: +        cnt_1 += 1 -        if s[i] == "1": -            cnt += 1 -print((min(cnt, len(s) - cnt))) +        cnt_2 += 1 +print((min(cnt_1, cnt_2)))