S = eval(input())

ans = [0, 0, 0, 0]



for i in range(len(S)):

    if (i % 2 == 0 and S[i] != '1') or (i % 2 == 1 and S[i] != '0'):

        ans[0] += 1

    if (i % 2 == 0 and S[i] != '0') or (i % 2 == 1 and S[i] != '1'):

        ans[1] += 1

    j = len(S) - i - 1

    if (j % 2 == 0 and S[j] != '1') or (j % 2 == 1 and S[j] != '0'):

        ans[2] += 1

    if (j % 2 == 0 and S[j] != '0') or (j % 2 == 1 and S[j] != '1'):

        ans[3] += 1

    

print((min(ans)))







S = eval(input())

ans = [0, 0]



for i in range(len(S)):

    if (i % 2 == 0 and S[i] != '1') or (i % 2 == 1 and S[i] != '0'):

        ans[0] += 1

    if (i % 2 == 0 and S[i] != '0') or (i % 2 == 1 and S[i] != '1'):

        ans[1] += 1

    

print((min(ans)))

S = eval(input())
ans = [0, 0, 0, 0]
for i in range(len(S)):
    if (i % 2 == 0 and S[i] != "1") or (i % 2 == 1 and S[i] != "0"):
        ans[0] += 1
    if (i % 2 == 0 and S[i] != "0") or (i % 2 == 1 and S[i] != "1"):
        ans[1] += 1
    j = len(S) - i - 1
    if (j % 2 == 0 and S[j] != "1") or (j % 2 == 1 and S[j] != "0"):
        ans[2] += 1
    if (j % 2 == 0 and S[j] != "0") or (j % 2 == 1 and S[j] != "1"):
        ans[3] += 1
print((min(ans)))

S = eval(input())
ans = [0, 0]
for i in range(len(S)):
    if (i % 2 == 0 and S[i] != "1") or (i % 2 == 1 and S[i] != "0"):
        ans[0] += 1
    if (i % 2 == 0 and S[i] != "0") or (i % 2 == 1 and S[i] != "1"):
        ans[1] += 1
print((min(ans)))

-ans = [0, 0, 0, 0] +ans = [0, 0] -    j = len(S) - i - 1 -    if (j % 2 == 0 and S[j] != "1") or (j % 2 == 1 and S[j] != "0"): -        ans[2] += 1 -    if (j % 2 == 0 and S[j] != "0") or (j % 2 == 1 and S[j] != "1"): -        ans[3] += 1